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. // find all the primes <= max(a) / 2 + 1 // share the primes //System.out.println(Arrays.toString(primeArr)); long total = 0; for (int i =0 ; i < a.length; i++) { total += longestSequence(a[i]); } return total; } private static long longestSequence(long a) { List primes = new ArrayList(); // find all prime divisors of a List div = new ArrayList(); while(a % 2 == 0) { div.add(2l); a /= 2; } Long sqrt = (long) Math.sqrt(a)+1; for (Long p = 3l; p < sqrt; p += 2) { while(a%p == 0) { div.add(p); a /= p; } } if (a > 2) div.add(a); // apply logics long count = 0; long curProd = 1; for (int i = div.size()-1; i >=0; i--) { curProd = curProd * div.get(i); count += curProd; } return count+1; } 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(); } }