import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long[] getFactors(long n) { List factorList = new ArrayList<>(); factorList.add(n); for (long i = n/2; i >= 1; i--) { if (n % i == 0) factorList.add(i); } return factorList.stream().mapToLong(l -> l).toArray(); } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long[] baseMoves = {1, 3, 4, 7, 6, 10, 8, 15, 13}; long seq = 0; for (int i = 0; i < a.length; i++) { long tmp = a[i]; long[] factors; while (tmp >= 10) { seq += a[i]/tmp; // System.out.println("tmp = " + tmp + " : " + "seq = " + seq); factors = getFactors(tmp); tmp = factors[2]; } seq += (a[i]/tmp) * baseMoves[(int)tmp-1]; // System.out.println("tmp = " + tmp + " : " + "seq = " + seq); } return seq; } 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(); } }