import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long[] primes ; static void sieveOfEratosthenes(int n) { int c = n ; boolean[] all_primes = new boolean[n+1]; Arrays.fill(all_primes, true); for (int i = 2; i <= Math.sqrt(n); i++) { for (int j = i * 2; j <= n; j += i) { if(all_primes[j]) c--; all_primes[j] = false; } } primes = new long[c]; int j=0; for(int i=2;i<=n;i++){ if(all_primes[i]){ primes[j]=i; j++; } } } static long cal (long i){ if(i==1) return 1; int x =0 ; long sum = i; do{ if(i%primes[x]==0){ i/=primes[x]; sum+= i; }else { x++; } }while(i>=primes[x]); return sum ; } static long longestSequence(long[] a) { long sum = 0; for(long i : a){ sum+=cal(i); } return sum; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; long max = 0; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); max=Math.max(max,a[a_i]); } sieveOfEratosthenes((int)max); long result = longestSequence(a); System.out.println(result); in.close(); } }