import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static HashMap solMap = new HashMap(); static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. initMap(); long sum =0; for (int i =0 ; i < a.length; i++){ sum += recursiveHelper(a[i]); } return sum; } static long recursiveHelper(long n){ if(solMap.containsKey(n)){ return solMap.get(n); } long d = largestPrimeFactor(n);//(long) Math.floor(Math.sqrt(n)); long ret = 0; ArrayList vals = new ArrayList(); // while (d > 1){ // if (n%d == 0){ // ret = (n/d * recursiveHelper(d))+1; // solMap.put(n, ret); // System.out.println(n + " "+d + " "+ ret); // vals.add(ret); // } // d--; // } // if(vals.size()>0){ // Collections.sort(vals); // ret = vals.get(vals.size()-1); // solMap.put(n, ret); // return ret; // } if (d != n){ ret = (d * recursiveHelper(n/d))+1; solMap.put(n, ret); return ret; } ret = n + 1; solMap.put(n, ret); return ret; } public static long largestPrimeFactor(long number) { long i; long copyOfInput = number; for (i = 2; i <= copyOfInput; i++) { if (copyOfInput % i == 0) { copyOfInput /= i; i--; } } return i; } static void initMap(){ solMap.put(1L,1L); solMap.put(2L,3L); } 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(); } }