import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static boolean isPrime(long n) { long i; for (i = 2; i <= Math.sqrt(n); i++) { if (n % i == 0) { return false; } } return true; } static long leastDivisor(long n) { long i; for (i = 2; i <= Math.sqrt(n); i++) { if (n%i == 0) { return i; } } return 0; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long total = 0; long n = 0; for (int i = 0; i < a.length; i++) { n = a[i]; while(n != 0) { if (n == 1) { total = total+1; break; } else if (isPrime(n)) { total = total + (n+1); break; } else if (n%2 != 0) { total = total + n; n = n/leastDivisor(n); } else if (n%2 == 0) { total = total + n; n = n/2; } } } 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(); } }