######################################## PROG cache = {} mx_at = {} def factors(n): return set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))) def primeFactors(n): out = set([]) while n % 2 == 0: #print 2, out.add(2) n = n / 2 # n must be odd at this point # so a skip of 2 ( i = i + 2) can be used for i in range(3, int(n**0.5) + 1, 2): # while i divides n , print i ad divide n while n % i == 0: #print i, out.add(i) n = n / i # Condition if n is a prime # number greater than 2 if n > 2: out.add(n) return out def get_ct(k): if k == 0: return 0 if k == 1: return 1 if k in cache: #print 'hit',k return cache[k] mx = 0 facts = primeFactors(k) #test code test_fact = max(facts) test_other = k // test_fact return max(k+1, 1+test_fact*get_ct(test_other)) #test code ends def longestSequence(a): # Return the length of the longest possible sequence of moves. #gen_cache_old() ct = 0 for each_ai in a: x = get_ct(each_ai) ct = ct + x #print each_ai, x return ct def main(): n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result if __name__ == "__main__": main()