import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long getBiggestDivisor(int n) { List integers = new ArrayList<>(); int d = 2; while (n > 1) { while (n % d == 0) { integers.add(d); n /= d; } d += 1; if(d * d > n) { if(n > 1) { integers.add(n); break; } break; } } for (Integer integer : integers) { System.out.print(integer + " "); } return 1; } static long largestPrimefactor (long n) { long largestPrimeFactor = 0; if(n % 2 == 0) { largestPrimeFactor = 2; while(n % 2 == 0){ n = n / 2; } } if(n % 3 == 0) { largestPrimeFactor = 3; while(n % 3 == 0){ n = n / 3; } } long multOfSix = 6; while(multOfSix - 1 <= n) { if(n % (multOfSix - 1) == 0) { largestPrimeFactor = multOfSix - 1; while(n % largestPrimeFactor == 0){ n = n / largestPrimeFactor; } } if(n % (multOfSix + 1) == 0) { largestPrimeFactor = multOfSix + 1; while(n % largestPrimeFactor == 0){ n = n / largestPrimeFactor; } } multOfSix += 6; } return largestPrimeFactor; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long count = 0; for (int i = 0; i < a.length; i++) { long move = 1; long number = a[i]; // System.out.println(number); if(number == 1) { count += move; continue; } long c = 1; while (number > 0) { long largestPrime = largestPrimefactor(number); if (largestPrime == number) { move += a[i]; break; } long num = number / largestPrime; // System.out.println(num + " " + largestPrime); move += largestPrime * c; c *= largestPrime; number = num; } // System.out.println(); count += move; } return count; } 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(); } }