import java.io.*; import java.util.*; public class BB { public static void main(String[] args)throws Throwable { MyScanner sc=new MyScanner(); PrintWriter pw=new PrintWriter(System.out); sieve((int)1e6+5); int n=sc.nextInt(); long ans=0; while(n-->0){ long x=sc.nextLong(); ArrayList f=primeFactors(x); ans+=x; long tot=1; for(long pf : f){ tot*=pf; ans+=x/tot; } } pw.println(ans); pw.flush(); pw.close(); } static ArrayList primes; static int[] isComposite; static void sieve(int N){ isComposite = new int[N+1]; isComposite[0] = isComposite[1] = 1; primes = new ArrayList(); for (int i = 2; i <= N; ++i) if (isComposite[i] == 0) { primes.add(i); if(1l * i * i <= N) for (int j = i * i; j <= N; j += i) isComposite[j] = 1; } } static ArrayList primeFactors(long N){ ArrayList factors = new ArrayList(); int idx = 0, p = primes.get(idx); while(1L*p * p <= N) { while(N % p == 0) { factors.add(1L*p); N /= p; } p = primes.get(++idx); } if(N != 1) factors.add(N); return factors; } static class MyScanner { BufferedReader br; StringTokenizer st; public MyScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() {while (st == null || !st.hasMoreElements()) { try {st = new StringTokenizer(br.readLine());} catch (IOException e) {e.printStackTrace();}} return st.nextToken();} int nextInt() {return Integer.parseInt(next());} long nextLong() {return Long.parseLong(next());} double nextDouble() {return Double.parseDouble(next());} String nextLine(){String str = ""; try {str = br.readLine();} catch (IOException e) {e.printStackTrace();} return str;} } }