import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; import static java.lang.Math.sqrt; public class Solution { long squr=0; static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long moves=0; long res=0; long num=0; for (int i = 0; i < a.length; i++) { if (a[i]>1) moves+=a[i]; if (a[i]>1&&dividable(a[i])>0){ num=a[i]; res=num/dividable(num); moves+=res; num=res; while(num>1&&dividable(num)>0){ res=num/dividable(num); moves+=res; num=res; } } moves+=1; } return moves; } public static long dividable(long x){ for (int i = 2; i <(sqrt(x)+sqrt(x)); i++) { // squr= sqrt(x); if(i==x) break; if (x%i==0){ return i;}} return 0; } 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(); } }