import java.io.*; import java.util.*; public class Solution { class Answer { int N; long[] arr; int[] primes = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97}; public boolean isPrime(long n) { if (n < 2) return false; if (n == 2 || n == 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; long sqrtN = (long) Math.sqrt(n) + 1; for (long i = 6L; i <= sqrtN; i += 6) { if (n % (i - 1) == 0 || n % (i + 1) == 0) return false; } return true; } public long smallestPrime(long num) { for (int i = 2; i < Math.sqrt(num); i++) { if (num % i == 0) { if ( isPrime(i) ); return i; } } return num; } public long solve(long n) { long ret = 0L; if (isPrime(n)) { return n + 1; } else { ret += n; while (n > 1) { if (n % 2 == 0) { n /= 2; ret += n; } else { if (n % 3 == 0) { n /= 3; ret += n; } else if (n % 5 == 0) { n /= 5; ret += n; } else if (n % 7 == 0) { n /= 7; ret += n; } else { n /= smallestPrime(n); ret += n; } } } } return ret; } public void main(FastScanner in, PrintWriter out) { N = in.nextInt(); arr = new long[N]; long sum = 0L; for (int i = 0; i < N; i++) { sum += solve( in.nextLong() ); } out.println(sum); } public void p(Object o) { System.out.print(o); } public void pl(Object o) { System.out.println(o); } public void arp(int[] o) { pl( Arrays.toString(o) ); } public void arpp(int[][] o) { for (int i = 0; i < o.length; i++) { for (int j = 0; j < o[0].length; j++) { p(o[i][j] + " "); } pl(""); } } public void ck(Object o1, Object o2) { pl(o1 + " " + o2); } public void ckk(Object o1, Object o2, Object o3) { pl(o1 + " " + o2 + " " + o3); } public void ckkk(Object o1, Object o2, Object o3, Object o4) { pl(o1 + " " + o2 + " " + o3 + " " + o4); } } public static void main(String[] args) throws Exception { InputStream inputStream = System.in; OutputStream outputStream = System.out; FastScanner in = new FastScanner(inputStream); PrintWriter out = new PrintWriter(outputStream); Solution problem = new Solution(); Answer ans = problem.new Answer(); ans.main(in, out); out.close(); in.close(); } static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { while (st == null || !st.hasMoreTokens()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } public String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } public void close() throws IOException { br.close(); } } }