#!/bin/python3 import sys def isPrime(num): i = 2 while i*i<=num: if num%i==0: return False i+=1 return True def allPrimes(n): ps = [True for i in range(n+1)] p = 2 ans = [] while (p * p <= n): if (ps[p] == True): for i in range(p * 2, n+1, p): ps[i] = False p += 1 for p in range(2, n): if ps[p]: ans.append(p) return ans def longestSequence(a,l): # Return the length of the longest possible sequence of moves. ans = 0 for i in range(len(a)): tmp = a[i] c = 1 if isPrime(tmp): if tmp == 1: ans+=1 else: ans += tmp+1 else: ans+=1 j = 0 p = [] while tmp>=l[j]: if tmp%l[j] == 0: d = tmp//l[j] if isPrime(d): tmp//=d p.append(d) tmp//=l[j] p.append(l[j]) else: j+=1 p.sort() for i in range(len(p)-1,-1,-1): c*=p[i] ans+=c return int(ans) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) pr = allPrimes(10**6+5) result = longestSequence(a,pr) print(result)