import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long a) { ArrayList km = new ArrayList<>(); for (int i : ss) { while (a % i == 0) { km.add((long) i); a /= i; } } if (a != 1) { km.add(a); } long cI = 1; long r = 0; for (int i = km.size() - 1; i >= 0; i--) { r += cI; cI *= km.get(i); } return r + cI; } static int[] ss = sieveEratosthenes(1_000_000); public static boolean[] sieveEratosthenesB(int n) { boolean[] tt = new boolean[n + 1]; Arrays.fill(tt, true); tt[0] = false; tt[1] = false; for (int i = 2; i * i <= n; i++) { if (!tt[i]) continue; for (int k = i * i; k <= n; k += i) { tt[k] = false; } } return tt; } public static int[] sieveEratosthenes(int n) { int[] nn = new int[n + 1]; boolean[] tt = sieveEratosthenesB(n); int k = 0; for (int i = 0; i <= n; i++) { if (tt[i]) { nn[k++] = i; } } return Arrays.copyOf(nn, k); } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long t = 0; for (int a_i = 0; a_i < n; a_i++) { t += longestSequence(in.nextLong()); } System.out.println(t); in.close(); } }