def primes(n): ps, sieve = [], [True] * (n + 1) #count = 0 for p in range(2, n + 1): if sieve[p]: #count += 1 # For counting the number of primes uncomment it ps.append(p) # Comment it for counting the number of primes for i in range(p * p, n + 1, p): sieve[i] = False return ps # Return count instead of ps if you want to count the number of primes less than n #def is_prime(n): #return n in primes(n) prime_data = primes(1000000) # And print count or ps as required n = int(input()) data = list(map(int, input().split())) ans = 0 for no in data: var = 0 ans += no try: while no != 1: while no % prime_data[var] == 0: no //= prime_data[var] ans += no var += 1 except: ans += 1 print(ans)