import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result = 0; for(long tmpV : a){ ArrayList tmpL = new ArrayList<>(); primeFactors(tmpV, tmpL); long cur = 1; for(int i = tmpL.size(); i >= 0; i-- ){ if(i == tmpL.size()) result += cur; else{ result += tmpL.get(i) * cur; cur *= tmpL.get(i); } } } return result; } public static void primeFactors(long n, ArrayList result) { // Print the number of 2s that divide n while (n%2==0) { result.add((long)2); n /= 2; } // n must be odd at this point. So we can // skip one element (Note i = i +2) for (int i = 3; i <= Math.sqrt(n); i+= 2) { // While i divides n, print i and divide n while (n%i == 0) { result.add((long)i); n /= i; } } // This condition is to handle the case whien // n is a prime number greater than 2 if(n > 2) result.add(n); } 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(); } }