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 totalMoves = 0; boolean found = false; long sum = 0; //For each stick, get max number of moves and add to total for (int i = 0; i < a.length; i++) { long toDivide = a[i]; sum = a[i]; if (sum > 1) { sum += 1; } while (toDivide > 1) { found = false; for (long j = 2; j <= Math.sqrt(toDivide); j++) { if (toDivide % j == 0) { sum += (toDivide / j); toDivide = toDivide / j; found = true; break; } } if (!found) { break; } } totalMoves += sum; } return totalMoves; } 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(); } }