import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static Map d = new HashMap<>(); static long longestSequence(long[] a) { long result = 0; for (int i = 0; i < a.length; i++) { result += longestSequence(a[i]); } return result; } static long longestSequence(long a) { if (d.containsKey(a)) return d.get(a); if (a == 1) return 1; long max = Long.MIN_VALUE; for (long l = 2; l <= a; l++) { if (a % l == 0) { long res = 1 + l * longestSequence(a / l); if (res > max) { max = res; } } } d.put(a, max); return max; } 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(); } }