import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long sum=0; for(int a_i = 0; a_i < n; a_i++){ long k = in.nextLong(); BigInteger b1 = new BigInteger(k+""); if(b1.isProbablePrime(100)) sum += (1+k); else { long div; while(k!=1) { sum += k; if(new BigInteger((k-1)+"").nextProbablePrime().longValue()==k) div = k; else div = dd(k); k = k/div; } sum++; } } System.out.print(sum); in.close(); } static long dd(long k) { for(int i=2;i*i<=k;i++) if(k%i==0) return i; return k; } }