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