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 res = 0; for (long stick : a) { res += helper(stick); } return res; } static long helper(long length) { if (length == 1) { return 1; } if (length % 2 == 0) { return length + helper(length/2); } if (isPrime(length)) { return 1 + length; } boolean found = false; long res = 0; for (long i = 3; i <= length/2; i++) { if (length % i == 0) { res = length + helper(length/i); found = true; } if (found) break; } return res; } static boolean isPrime(long n) { if (n <= 1) return false; for (long i = 2; i * i <= n; i++) { if (n % i == 0) return false; } return true; } 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(); } }