import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { private static Map memo = new HashMap<>(); static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long result = 0; for (int i = 0; i < a.length; i++) { result = result + solve(a[i]); } return result; } private static long solve(long a) { if (a == 1) { return 1; } Long memoized = memo.get(a); if (memoized != null) { return memoized; } Collection divisors = divisors(a); long max = 0; for (long div:divisors) { long way = solve(a/div) * div + 1; if (way > max) { max = way; } } memo.put(a, max); return max; } private static Collection divisors(long a) { List divisors = new ArrayList<>(); for (long i = 2; i < Math.sqrt(a) + 1; i++) { if (a % i == 0) { divisors.add(i); long other = a / i; if ((other != i) && (other != 1)) { divisors.add(other); } } } if (a != 1) { divisors.add(a); } return divisors; } 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(); } }