import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static boolean isPrime(long n) { int s= 0; for(int i=2; i max) { max = maxSoFar; } } } parts[(int)a] = max; } } static long findMoves(long a) { long sum = a; long[] parts = new long[(int) (a+1)]; parts[1] = 1; if(a>= 2){ parts[2] = 3; } if(a>= 3){ parts[3] = 4; } for(int i=4; i<=a; i++) { if(a%i == 0) { findParts(i, parts); } } return parts[(int)a]; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long sum = 0; for(int i=0; i< a.length; i++) { sum+=findMoves(a[i]); } return sum; } 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(); } }