#!/bin/python3 import sys import math from functools import lru_cache def find_max_prime_factor(size): while size % 2 == 0: max_prime = 2 size //= 2 for i in range(3, math.floor(math.sqrt(size)) + 1, 2): while size % i == 0: max_prime = i size //= i if size > 2: max_prime = size return max_prime def longestSequence(a): # Return the length of the longest possible sequence of moves. @lru_cache(maxsize=None) def helper(size): if size == 1: return 1 max_prime_factor = find_max_prime_factor(size) res = 1 + max_prime_factor * helper(size // max_prime_factor) return res total = 0 for i in a: total += helper(i) return total if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)