import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Hashtable cacheAnswers; static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. cacheAnswers = new Hashtable(); cacheAnswers.put((long)1, (long)1); long sum = 0; for(int i = 0; i < a.length; i++){ if (cacheAnswers.containsKey(a[i])){ sum += cacheAnswers.get(a[i]); } else{ long current = findVal(a[i]); sum += current; cacheAnswers.put(a[i], current); } } return sum; } static long findVal(long num){ long originalNum = num; long total = num; for(int i = 2;i <= Math.sqrt(originalNum); i++){ while (num % i == 0 ){ num /= i; total += num; } if (num == 1){ return total; } } return num == 1 ? 1 : total + 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(); } }