import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a, long max) { // Return the length of the longest possible sequence of moves. long ans = 0; HashMap map = new HashMap<>(); map.put(1L,1L); for(long n : a){ helper(n, map); ans += map.get(n); } //System.out.println(map); return ans; } static void helper(long n, HashMap map){ //System.out.println("*" + n + " map = " + map); for(long i = 1; i <= n/2; i++){ if(n % i == 0){ if(!map.containsKey(i)) helper(i, map); long val = map.get(i) * (n/i) + 1; if(!map.containsKey(n) || map.get(n) < val) map.put(n, val); } } //System.out.println(n + " map = " + map); } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; long max = 0; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); max = Math.max(max, a[a_i]); } long result = longestSequence(a, max); System.out.println(result); in.close(); } }