import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static boolean[] primes(int n) { boolean[] primes = new boolean[n + 1]; for (int i = 2; i < primes.length; i++) { primes[i] = true; } int num = 2; while (true) { for (int i = 2;; i++) { int multiple = num * i; if (multiple > n) { break; } else { primes[multiple] = false; } } boolean nextNumFound = false; for (int i = num + 1; i < n + 1; i++) { if (primes[i]) { num = i; nextNumFound = true; break; } } if (!nextNumFound) { break; } } return primes; } static long process (long s, boolean[] primes){ if(s==1) return 1; if(s==2) return 3; for(int i=primes.length-1;i>=0;i--) { if(primes[i] && i==1) return s+1; if(primes[i] && s % i == 0 ) return 1+i*process(s/i, primes); } return 1; } static long longestSequence(long[] a) { long res = 0; long tmpMax = a[0]; for(long val:a) { if(val>tmpMax) tmpMax = val; } boolean[] primeList = primes(((int)tmpMax)); for(long val:a) res += process(val, primeList); return res; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); } long result = longestSequence(a); System.out.println(result); in.close(); } }