import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static boolean isPrime(long num) { if (num < 2) return false; if (num == 2) return true; if (num % 2 == 0) return false; for (long i = 3; i * i <= num; i += 2) if (num % i == 0) return false; return true; } public static ArrayList primeFactorization(long num) { long n = num; ArrayList factors = new ArrayList(); for (long i = 2; i <= n / i; i++) { while (n % i == 0) { factors.add(i); n /= i; } } if (n > 1) { factors.add(n); } return factors; } static long singleLongestSequence(long a) { long moves = 0; long cur = a; if (isPrime(cur)) { moves = cur + 1; } else { ArrayList primes = primeFactorization(a); long[] steps = new long[primes.size()]; moves = cur; for (int i = 0; i < primes.size(); i++) { steps[i] = cur / primes.get(i); cur /= primes.get(i); } for (long x : steps) { moves += x; } } return moves; } static long longestSequence(long[] a) { long totalMoves = 0; for (long m : a) { totalMoves += singleLongestSequence(m); } return totalMoves; } 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(); } }