import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Map memo = null; static boolean isPrime(long a) { if (a < 2) return false; int upperLimit = (int) Math.sqrt(a); for (int i = 2; i <= upperLimit; ++i) if (a % i == 0) return false; return true; } static long longestSequenceUtil(long a) { if (a == 1) return 1; if (memo.get(a) != null) { //System.out.println(a + ": memo " + memo.get(a)); return memo.get(a); } long max = Long.MIN_VALUE; long answer = 0; if (isPrime(a)) { answer = 1 + a; } else { int upperLimit = (int)Math.sqrt(a); for (int d = 2; d <= upperLimit; ++d) { if (a % d == 0) { answer = (a / d) * longestSequenceUtil(d); max = Long.max(max, answer); answer = d * longestSequenceUtil(a / d); max = Long.max(max, answer); } } answer = 1 + max; } memo.put(a, answer); return answer; } static long longestSequence(long[] a) { memo = new Hashtable(); long ls = 0; for (int i = 0; i < a.length; ++i) { long answer = longestSequenceUtil(a[i]); ls += answer; //System.out.println(a[i] + " " + answer); } return ls; } 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(); } }