# Enter your code here. Read input from STDIN. Print output to STDOUT import sys import math def primeFactors(n): factors=[] # Print the number of two's that divide n while n % 2 == 0: factors.append(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(math.sqrt(n))+1,2): # while i divides n , print i ad divide n while n % i== 0: factors.append(i), n = n / i # Condition if n is a prime # number greater than 2 if n > 2: factors.append(n) return (factors) def is_prime(a): return all(a % i for i in range(2, a)) def longestSequence(a): # Return the length of the longest possible sequence of moves. total=0 for c in a: factors=sorted(primeFactors(c),reverse=True) if len(factors)==0: total +=1 elif len(factors)==1: total +=c+ 1 else: total +=1 d=1 for f in factors: d *=f total +=d return int(total) if __name__ == "__main__": n = int(input().strip()) a = map(int, input().strip().split(' ')) result = longestSequence(a) print (result)