import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a){ long longestSeq = 0; for (int i = 0; i < a.length; i++){ longestSeq += longestSequence(a[i]); } return longestSeq; } static long longestSequence(long a) { long numToCount = a; long longest = 0; long modifier = 1; while (numToCount != 1){ long numToAdd = greatestPrimeDivisor(numToCount); longest += numToAdd*modifier; modifier *= numToAdd; numToCount /= numToAdd; } return longest+1; } static long greatestPrimeDivisor(long a){ long result = -1; for(long d = a; d >= 1; d--){ if (a % d == 0){ if (isPrime(d)) { result = d; break; } } } return result; } static boolean isPrime(long n) { if (n == 1) return false; if (n == 2) return true; if (n % 2 == 0) return false; for(long i = 3; i*i<=n; i+=2) { if(n % i == 0){ return false; } } return true; } 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(); } }