# Enter your code here. Read input from STDIN. Print output to STDOUT precalc = {1 : 1} def is_prime(x): for i in range(2,int(x**0.5)+1): if x%i==0: return (i,False) return (None,True) def calc(x): if x in precalc: return precalc[x] else: d,b = is_prime(x) if b: precalc[x] = x+1 else: precalc[x] = x + calc(x//d) return precalc[x] def longestSequence(a): # Return the length of the longest possible sequence of moves. summ = 0 for x in a: summ+=calc(int(x)) return summ if __name__ == "__main__": n = input() a = input().strip().split(' ') result = longestSequence(a) print(result)