import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(in.readLine()); long[] a = new long[n]; StringTokenizer st = new StringTokenizer(in.readLine()); Map map = new HashMap<>(); long total = 0; for (int i = 0; i < n; i++) { a[i] = Long.parseLong(st.nextToken()); if (!map.containsKey(a[i])) map.put(a[i], moves(a[i])); total = total + map.get(a[i]); } System.out.println(total); in.close(); } static long moves(long num) { long n = num; List 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); long sum = num, curr = 1; for (long i: factors) { curr = curr * i; sum = sum + num / curr; } return sum; } static List primeFactors(long numbers) { long n = numbers; List 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; } }