import java.util.*; import java.io.*; import java.math.BigDecimal; import java.math.BigInteger; import java.math.MathContext; public class Es { static long fun(long N, Vector factors, Vector exponents, int i) { if(N == 1) return 1; if(exponents.get(i) == 0) return fun(N, factors, exponents, i - 1); exponents.set(i, exponents.get(i) - 1); return 1 + factors.get(i) * fun(N / factors.get(i), factors, exponents, i); } public static void main(String[] args) { Vector primes = new Vector (); boolean[] done = new boolean[1000001]; for(int i = 2; i <= 1000000; i ++) { if(done[i]) continue; primes.add((long)i); for(int j = i; j <= 1000000; j += i) done[j] = true; } int t = in.nextInt(); long ans = 0; while(t -- > 0) { long n = in.nextLong(); long N = n; Vector factors = new Vector (); Vector exponents = new Vector (); for(int i = 0; i < primes.size(); i ++) { if(n % primes.get(i) != 0) continue; factors.add(primes.get(i)); long e = 0; while(n % primes.get(i) == 0) { n /= primes.get(i); e ++; } exponents.add(e); } if(n > 1) { factors.add(n); exponents.add(1L); } ans += fun(N, factors, exponents, factors.size() - 1); } sop(ans); } static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { 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; } } static FastReader in = new FastReader(); public static void sop(Object o) { System.out.print(o); } }