import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Map md = new HashMap(); static Map moves = new HashMap(); static long getMD(long n){ if(!md.containsKey(n)){ if(n == 1l){ md.put(n, 1l); }else if(n%2 ==0){ md.put(n,2l); }else{ for(long i=3l;i<=Math.sqrt(n);i+=2){ if(n%i ==0){ md.put(n,i); break; } } if(!md.containsKey(n)){ md.put(n, n); } } } return md.get(n); } static long getMoves(long n){ if(!moves.containsKey(n)){ if(n ==1l){ moves.put(n,1l);} else{ long div = getMD(n); moves.put(n, n+getMoves(n/div)); } } return moves.get(n); } static long longestSequence(long[] a) { long total = 0; for(long l : a){ total += getMoves(l); } 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(); } }