import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { long total = 0; for (long l : a) { while (l > 0) { if (l == 1) { total++; l--; }else if(l % 2 == 0){ total += l; l /= 2; }else{ int divisor = getFirstDivisor(l); if(divisor != -1){ total += l; l /= divisor; }else{ total += l; l /= l; } } } } return total; } static int getFirstDivisor(long n) { int to = (int) Math.sqrt(n); for (int i = 3; i <= to; i += 2) { if (n % i == 0) { return i; } } return -1; } 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(); } }