import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; i++) { a[i] = sc.nextLong(); } long longestSequence = 0; List primes = getPrimes(); for (int i = 0; i < n; i++) { long current = a[i]; longestSequence+= current; if (current > 1){ for (Long p: primes) { while (current%p == 0){ current/=p; longestSequence+=current; } if (p*p > current){ break; } } if (current > 1){ longestSequence+=1; } } } System.out.println(longestSequence); } public static List getPrimes() { List primes = new ArrayList<>(); for (long i = 2; i < 1000000L; i++){ boolean isPrime = true; for (Long prime: primes) { if (prime*prime > i){ break; } if (i%prime == 0){ isPrime = false; break; } } if(isPrime){ primes.add(i); } } return primes; } }