import java.util.*; public class Solution { static long plusGrandNbPremier(long a) { long result = a; for (long i = 2; i <= a/2; i++) { if (a%i==0) { if (premier(i)) result = i; } } return result; } private static boolean premier(long i) { boolean result = true; for (int j = 2; j <= i / 2; j++) { if (i%j==0) { result = false; } } return result; } static long longestSequenceAi (long ai) { if (ai==1) { return 1; } else { long nb = plusGrandNbPremier(ai); return 1 + nb*longestSequenceAi(ai/nb); } } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result = 0; for (int i = 0; i < a.length; i++) { result += longestSequenceAi(a[i]); } return result; } 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(); } }