import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static PrimeSieve sieve = new PrimeSieve(1000001); static long calc(long a) { if (a == 1) return 1; for (int i = sieve.primeCount - 1; i >= 0; i--) { if (a % sieve.primes[i] == 0) return sieve.primes[i] * calc(a / sieve.primes[i]) + 1; } return a + 1; } static long longestSequence(long[] a) { long total = 0; for (int i = 0; i < a.length; i++) { //total += calc(a[i]); long aa = a[i]; int j = 0; total += aa; while (j < sieve.primeCount && aa > 1) { if (aa % sieve.primes[j] == 0) { aa /= sieve.primes[j]; total += aa; } else { j++; } } if (aa > 1) { total++; } } return total; } 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(); } static class PrimeSieve { public PrimeSieve(int limit) { this.limit = limit; this.runSieve(); } private void runSieve() { this.isPrime = new boolean[this.limit + 1]; this.isPrime[0] = this.isPrime[1] = false; for (int i = 2; i <= this.limit; i++) { this.isPrime[i] = true; } this.primeCount = 0; for (int i = 2; i <= this.limit; i++) { if (this.isPrime[i]) { this.primeCount++; int j = i * 2; while (j <= this.limit) { this.isPrime[j] = false; j += i; } } } this.primes = new int[this.primeCount]; this.primeCount = 0; for (int i = 2; i <= this.limit; i++) { if (this.isPrime[i]) { this.primes[this.primeCount] = i; this.primeCount++; } } } int limit; boolean isPrime[]; int[] primes; int primeCount; } }