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_sum = 0; long p; for(long i : a){ long current_sum = i; long temp = i; if(i>1){ do{ p = smallPrime(temp); temp = temp/p; current_sum += temp; }while(temp!=1); } total_sum += current_sum; } return total_sum; } 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(); } private static long smallPrime(long n) { for(long i=2;i<=Math.sqrt(n);i++){ if(n%i==0) return i; } return n; } }