import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static boolean isPrime(long n) { if (n%2 == 0 || n%3 == 0) return false; for (int i=5; i*i<=n; i=i+6){ if (n%i == 0 || n%(i+2) == 0) return false; } return true; } public static long largestPrimeFactor(long n) { long maxPrime = -1; // Print the number of 2s that divide n while (n % 2 == 0) { maxPrime = 2; n >>= 1; // equivalent to n /= 2 } // n must be odd at this point, thus skip // the even numbers and iterate only for // odd integers for (int i = 3; i <= Math.sqrt(n); i += 2) { while (n % i == 0) { maxPrime = i; n = n / i; } } // This condition is to handle the case // when n is a prime number greater than 2 if (n > 2) maxPrime = n; return maxPrime; } static long longestSequence(long a) { int j=(int)a; switch(j) { case 0:return 0; case 1: return 1; case 2:return 3; case 3:return 4; case 4:return 7; case 5:return 6; case 6:return 10; case 7:return 8; case 8:return 15; case 9:return 13; case 10:return 16; case 11:return 12; case 12:return 22; case 13:return 14; case 14:return 22; case 15:return 21; case 16:return 31; case 17:return 18; case 18:return 31; case 19:return 20; case 20:return 36; case 21:return 29; case 22:return 34; case 23:return 24; case 24:return 46; case 25:return 31; case 26:return 40; case 27:return 40; case 29:return 30; case 28:return 50; case 30:return 51; case 31:return 32; case 37:return 38; case 41:return 42; case 43: case 47: case 53: case 59: case 61: case 67: case 71: case 73: case 79: case 83: case 89: case 97:return j+1; } if(isPrime(a)) return a+1; else { long f=largestPrimeFactor(a); return 1+f*longestSequence(a/f); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; long result=0; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); result = result+longestSequence(a[a_i]); } System.out.println(result); in.close(); } }