# Enter your code here. Read input from STDIN. Print output to STDOUT def extract(x,primes): result = 1 for prime in primes: if x == prime: return result if x%prime == 0: z = x/prime result = z + extract(z,primes) return result return result lim = 10**6 + 1 N = range(lim) primes = [] for i in xrange(2,lim): if N[i] != 0 : primes.append(i) for j in xrange(2*i,lim,i): N[j]=0 n = input() arr = map(int,raw_input().strip().split()) result = 0 for x in arr: if x == 1: result +=1 continue result += x+extract(x,primes) print result