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 result= 0; for(long x:a){ result += find(x); } return result; } static long find(long x){ return helper(x); } static long helper(long x){ long result = 0; while(x>0){ if(x==1){ result+=1L; break; }if(isPrime(x)){ result+=x+1L; break; }else if (x%2==0){ result+=x; x = x/2; }else { for(long i=3;i*i<=x;i+=2){ if(x%i==0){ result+=x; x = x/i; break; } } } } return result; } static boolean isPrime(long n) { //check if n is a multiple of 2 if (n%2==0) return false; //if not, then just check the odds for(long i=3;i*i<=n;i+=2) { if(n%i==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(); } }