import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Map difisorsMap = new HashMap(); static long longestSequence(long[] a) { long result = 0; for(long i : a) { long g = findDivisors(i); result += g; } // System.out.println(difisorsMap); return result; } public static void main(String[] args) { difisorsMap.put(1l, 1l); difisorsMap.put(2l, 3l); 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(); } static long findDivisors(long a) { if (difisorsMap.containsKey(a)) { return difisorsMap.get(a); } else { long divisors = a; // Note that this loop runs till square root boolean found = false; for (int i=2; i<=Math.sqrt(a)+1; i++) { if (a%i==0) { divisors += findDivisors(a/i); found = true; break; } } if (!found) { divisors++; } difisorsMap.put(a, divisors); return divisors; } } }