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 total = 0; for (int i = 0; i < a.length; i++) { total += maxMoves(a[i]); } return total; } static long maxMoves(long x) { /*if (x == 1) { return 1; } for (long i = 2; i < x/2; i++) { if (x % i == 0 ) { return x + maxMoves(x / i); } } return x + 1;*/ if(x == 1) return 1; if(x % 2 == 0) { return x + maxMoves(x / 2); } for (int i = 3; i <= Math.sqrt(x); i+=2) { if (x % i == 0) { return x + maxMoves(x / i); } } return x + 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(); } }