import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { boolean[] primeSieve = new boolean[1000001]; List primes = new ArrayList(); primes.add(2); for (int i = 3; i < primeSieve.length; i += 2) { if (!primeSieve[i]) { primes.add(i); for (int j = 3*i; j < primeSieve.length; j += 2*i) primeSieve[j] = true; } } long total = 0; for (long x : a) { total += x; for (int p : primes) { while (x%p==0) { x /= p; total += x; } if (x == 1) break; } if (x > 1) total++; } return total; } 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(); } }