import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class breakingSticks { static boolean sieve[] = new boolean[1000001]; static void criba() { // sieve[0] = sieve[1] = true; for (int i = 2; i * i < 1000000; i++) { if (!sieve[i]) { for (int j = i * i; j <= 1000000; j += i) { sieve[j] = true; } } } } static long longestSequence(long[] a) { long res = 0; criba(); for (int i = 0; i < a.length; i++) { long act = a[i]; while (act != 0) { if (!sieve[(int) act]) { if (act != a[i]) { res += act + 1; } else { if (act != 1) res += act + 1; else res++; } break; } else { if (act % 2 == 0) { res += act; act /= 2; } else if (act % 3 == 0) { res += act; act /= 3; } else if (act % 5 == 0) { res += act; act /= 5; } else if (act % 7 == 0) { res += act; act /= 7; } } } } 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(); } }