import java.util.*; import java.io.*; import java.math.*; public class Solution { static BufferedReader in; static StringTokenizer stk; static int T, N, M, K; static PrintWriter out; static long[] primes; public static void main(String[] args) throws Exception { out = new PrintWriter(new OutputStreamWriter(System.out)); boolean oj = System.getProperty("TESTING_IN_ECHELON") != null; if (oj) { in = new BufferedReader(new FileReader("src/in.txt")); } else { in = new BufferedReader(new InputStreamReader(System.in)); } // Start of User Code primes = primes(1000000); T = ni(); long res = 0; for (int i = 0; i < T; i++) { res += proc(); } System.out.println(res); // End of User Code out.flush(); in.close(); } static long proc() throws Exception { long a = nl(); TreeMap pf = prime_factrization(a, primes); long res = getAns(pf); // Long[] factors = new TreeSet(factors(a, primes)).toArray(new Long[0]); // Long[] ans = new Long[factors.length]; // System.out.println(factors.length); // ans[0] = 1L; // for (int i = 1; i < factors.length; i++) { // long max = 1; // for (int j = 0; j < i; j++) { // if (factors[i] % factors[j] == 0) { // max = max(max, 1 + ans[j] * (factors[i] / factors[j])); // } // } // ans[i] = max; // } //System.out.println(res == ans[ans.length - 1]); return res; } static long getAns(TreeMap pf){ if(pf.isEmpty()) return 1; long maxP = pf.lastKey(); if(pf.get(maxP) == 1){ pf.remove(maxP); }else{ pf.put(maxP, pf.get(maxP) - 1); } return 1L + maxP * getAns(pf); } static long[] primes(int n) { boolean[] np = new boolean[n]; np[0] = true; np[1] = true; int pc = 0; for (int i = 2; i < n; i++) { if (!np[i]) { pc++; for (int j = i + i; j < n; j += i) { np[j] = true; } } } long[] p = new long[pc]; pc = 0; for (int i = 0; i < n; i++) { if (!np[i]) { p[pc++] = i; } } return p; } static LinkedList factors(TreeMap pf) { LinkedList res = new LinkedList(); res.add(1L); for (Long p : pf.keySet()) { LinkedList temp = new LinkedList(); long q = 1; for (int i = 0; i < pf.get(p); i++) { q *= p; for (Long d : res) { temp.add(d * q); } } res.addAll(temp); } //System.out.println(res); return res; } static LinkedList factors(long n, long[] primes) { return factors(prime_factrization(n, primes)); } static TreeMap prime_factrization(long n, long[] primes) { TreeMap res = new TreeMap(); for (long p : primes) { if (p > n) { break; } if (n % p == 0) { res.put(p, 0); while (n % p == 0) { n /= p; res.put(p, res.get(p) + 1); } } } if (n > 1) { res.put(n, 1); } return res; } static long modPow(long n, long pow, long mod) { return BigInteger.valueOf(n).modPow(BigInteger.valueOf(pow), BigInteger.valueOf(mod)).longValue(); } static long modInv(long n, long mod, boolean isPrimeModuli) { if (isPrimeModuli) { return modPow(n, mod - 2, mod); } return BigInteger.valueOf(n).modInverse(BigInteger.valueOf(mod)).longValue(); } // calc factorials static long[] fact; static void calcFactorials(int n) { fact = new long[n + 1]; fact[0] = 1; for (int i = 1; i <= n; i++) { fact[i] = fact[i - 1] * i; } } static void calcFactorialsModM(int n, long M) { fact = new long[n + 1]; fact[0] = 1; for (int i = 1; i <= n; i++) { fact[i] = fact[i - 1] * i; fact[i] %= M; } } static long ncr(int n, int r) { return fact[n] / (fact[n - r] * fact[r]); } static long ncrModM(int n, int r, long MOD, boolean isPrimeModuli) { return (((fact[n] * modInv(fact[n - r], MOD, isPrimeModuli)) % MOD) * modInv(fact[r], MOD, isPrimeModuli)) % MOD; } static long toL(String s) { return Long.parseLong(s); } static long toL(BigInteger n) { return n.longValue(); } static int toI(String s) { return Integer.parseInt(s); } static double toD(String s) { return Double.parseDouble(s); } static void printf(String format, Object... args) { out.printf(format, args); } static int ni() throws Exception { while (stk == null || !stk.hasMoreTokens()) { stk = new StringTokenizer(in.readLine()); } return Integer.parseInt(stk.nextToken()); } static long nl() throws Exception { while (stk == null || !stk.hasMoreTokens()) { stk = new StringTokenizer(in.readLine()); } return Long.parseLong(stk.nextToken()); } static double nd() throws Exception { while (stk == null || !stk.hasMoreTokens()) { stk = new StringTokenizer(in.readLine()); } return Double.parseDouble(stk.nextToken()); } static String ns() throws Exception { while (stk == null || !stk.hasMoreTokens()) { stk = new StringTokenizer(in.readLine()); } return stk.nextToken(); } static int min(int a, int b) { return a < b ? a : b; } static int max(int a, int b) { return a > b ? a : b; } static long min(long a, long b) { return a < b ? a : b; } static long max(long a, long b) { return a > b ? a : b; } static int gcd(int a, int b) { if (b == 0) { return a; } return gcd(b, a % b); } static long gcd(long a, long b) { if (b == 0) { return a; } return gcd(b, a % b); } }