import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static ArrayList primeArrays = new ArrayList(); static ArrayList divisorArrays; static ArrayList timesArrays; static long longestSequence(long[] a) { long sum = 0; Arrays.sort(a); calculatePrimeNumbersUntil(a[a.length-1]); for(int a_i = 0; a_i < a.length; a_i++){ sum += calculateSequenceForOne(a[a_i]); } return sum; // Return the length of the longest possible sequence of moves. // i should use longs for number length. //divide by lower divisor, //add 1 per division * division value. } static void calculatePrimeNumbersUntil(long a){ a = (long) Math.floor(Math.sqrt((double)a)); primeArrays.add(2); primeArrays.add(3); for(int i=3;i<=a;i+=2) { boolean flag = true; for(int j : primeArrays){ if(i % j==0){ flag = false; } } if(flag){ primeArrays.add(i); } } } static long calculateSequenceForOne(long a) { divisorArrays = new ArrayList(); timesArrays = new ArrayList(); if(a ==1){ return 1; } if(isPrime(a)){ return a + 1; }else{ long value = a; //timesArrays.set(0,timesArrays.get(0)-1 ); for(int div : divisorArrays){ int times =timesArrays.get(divisorArrays.indexOf(div)); while(times > 0){ long tempa = a / div; value += tempa; times--; a = tempa; } } return value; } } static boolean isPrime(long a){ boolean flag = true; for(int j : primeArrays){ if (j > a){ break; } while(a % j == 0){ flag = false; a = a / j; if(divisorArrays.contains(j)){ int timesIndex = divisorArrays.indexOf(j); timesArrays.set(timesIndex,timesArrays.get(timesIndex)+1); }else{ timesArrays.add(1); divisorArrays.add(j); } } } return flag; } 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(); } }