def prime_factors(n): i = 2 factors = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(i) if n > 1: factors.append(n) return factors def solve(p_f): ans1, ans2 = [0,1] for i in xrange(len(p_f)-1, -1, -1): ans1 += ans2 ans2 *= p_f[i] return ans1 + ans2 _, ans = input(), 0 arr = map(int, raw_input().split()) for i in arr: p_f = prime_factors(i) ans += solve(p_f) print ans