import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long kbreak(long k, Map dp) { System.err.println(k); if (dp.get(k) != null) { return dp.get(k); } if (k == 1) { dp.put(1L, 1L); return 1; } long max = k * dp.get(1L); for (int i = 2; i <= k / 2; i++) { if (k % i == 0) { long v1 = kbreak(i, dp); long v2 = kbreak(k / i, dp); long mx = Math.max((k / i) * v1, i * v2); if (max < mx) { max = mx; } } } dp.put(k, 1 + max); return max; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. Map dp = new HashMap(); dp.put(1L, 1L); dp.put(2L, 3L); for (long v : a) { kbreak(v, dp); } System.err.println(dp); int sum = 0; for (long v : a) { sum += dp.get(v); } 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(); } }