import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static boolean isPrime(long num) { if(num < 2) { return false; } if(num == 2 || num == 3) { return true; } if(num % 2 == 0 || num % 3 == 0) { return false; } long sqrtN = (long)Math.sqrt(num)+1; for(long i = 6; i <= sqrtN; i += 6) { if(num%(i-1) == 0 || num%(i+1) == 0) { return false; } } return true; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result = 0; for(int n = 0; n < a.length; n++){ if(isPrime(a[n])) { result += a[n] + 1; continue; } long moves = 1; long mul = 2; for(long m = 1; m <= a[n]; m = moves * mul) { if(a[n] % m == 0 && m % moves == 0) { moves = m; result += a[n] / m; //System.out.println("m: " + m + " result: " + result); }else { mul++; } } } return result; } 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(); } }