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 total = 0; //static Map map = new HashMap<>(); for(long k : a){ long subTotal = 1; long reducer = k; long incrementer = 1; List set = primeFactors(k); //Collections.sort(set); //Collections.reverse(set); for(Long v : set){ if(reducer%v == 0){ reducer /=v; incrementer*=v; subTotal += incrementer; } } total+= subTotal; } return total; } public static List primeFactors(long numbers) { long n = numbers; List factors = new ArrayList<>(); int count = 0; for (long i = 2; i <= n / i; i++) { while (n % i == 0) { factors.add(0,i); n /= i; } } if (n > 1) { factors.add(0,n); } return factors; } 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(); } }