import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static long getMinCD(long val) { long minCD = 2; boolean found = false; while (!found && minCD < val) { if (val % minCD == 0) { found = true; } else { minCD++; } } return minCD; } private static long calcMovements (long size, long count) { long finalCount = count + size; while (size > 1) { long mcD = getMinCD(size); long newSize = size / mcD; return calcMovements(newSize, finalCount); } return finalCount; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long totalCount = 0; for (Long val : a) { totalCount += calcMovements(val,0); } return totalCount; } 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(); } }