import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static ArrayList p = criv(); static long longestSequence(long[] a) { long ans = 0; for(long i : a){ ans += solve(i); } return ans; } public static long solve(long i){ if(i==1) return 1; ArrayList d = res(i); long ans = 0; //Collections.sort(d, Collections.reverseOrder()); Collections.reverse(d); Long mult = (long) 1; for(Long x : d){ ans += mult; mult *= x; } ans += mult; return ans; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); } long result = longestSequence(a); System.out.println(result); in.close(); } public static ArrayList res(long n){ ArrayList r = new ArrayList(); while(n>1){ boolean found = true; for(Long x : p){ if(n%x==0){ found = false; r.add(x); n/=x; break; } } if(found){ r.add(n); break; } } return r; } public static ArrayList criv(){ ArrayList primes = new ArrayList(); primes.add( (long) 2); for(Long i = (long) 3; i<=1000001 ; i+=2){ boolean found = true; for(Long x : primes){ if(x>Math.sqrt(i)){break;} if(i%x==0){ found = false; break;} } if(found){ primes.add(i); } } return primes; } }