import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static Hashtable maxMoves = new Hashtable(); static long longestSequence(long[] array, int n) { long sum = 0; for(int i = 0; i < n; i ++) { sum = sum + getMaxMoves(array[i]); } return sum; } static long getMaxMoves(long number) { if (maxMoves.containsKey(number)) { return maxMoves.get(number); } long maxValue = 0; double sqrtNumber = Math.pow((double)number,0.5) + 0.000001; for(int i = 2; i <= sqrtNumber; i ++) { if(number % i == 0) { maxValue = Math.max(maxValue, i*getMaxMoves(number/i) + 1); maxValue = Math.max(maxValue, (number/i)*getMaxMoves(i) + 1); } } if(maxValue == 0) { maxValue = number + 1; } maxMoves.put(number,maxValue); return maxValue; } 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(); } maxMoves.put((long)1,(long)1); maxMoves.put((long)2,(long)3); long result = longestSequence(a,n); System.out.println(result); in.close(); } }