import math def primeFactors(n): r = [] while n % 2 == 0: r.append(2) n = n / 2 for i in range(3, int(math.sqrt(n)) + 1, 2): while n % i == 0: r.append(i) n = n / i if n > 2: r.append(n) return r def solve(n): r = primeFactors(n) ret = n for i in r: n /= i ret += n return ret n = int(raw_input()) print sum(map(lambda x: solve(x), map(int, raw_input().split(' '))))