import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static TreeSet getPrimes(int upto) { TreeSet primes = new TreeSet<>(); for (long i = 2; i < upto; i++) { if (isPrime(primes, i)) { primes.add(i); } } return primes; } static long longestSequence(long[] a) { TreeSet primes = getPrimes(1000000); long total = 0; for (long val : a) { total += bestSum(val, primes); } return total; } private static long bestSum(final long val, TreeSet primes) { if (val == 1) { return 1; } if (primes.contains(val)) { return val + 1; } // Get biggest prime factor long biggestFactor = biggestPrimeFactor(val, primes); return 1 + biggestFactor * bestSum(val / biggestFactor, primes); } private static long biggestPrimeFactor(final long val, TreeSet primes) { if (val == 1 || primes.contains(val)) { return val; } for (final long f : primes) { if (val % f == 0) { return Math.max(f, biggestPrimeFactor(val / f, primes)); } } throw new RuntimeException("" + val); } private static boolean isPrime(TreeSet primes, long i) { if (primes.contains(i)) { return true; } double sqrt = Math.sqrt(i) + 1; for (long prime : primes) { if (prime > sqrt) { return true; } if (i % prime == 0) { return false; } } return true; } 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(); } }