import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.io.*; import java.math.*; import java.text.*; import java.util.*; import java.util.regex.*; /* br = new BufferedReader(new FileReader("input.txt")); pw = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); */ public class Main { private static BufferedReader br; private static StringTokenizer st; private static PrintWriter pw; public static void main(String[] args) throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); //int qq = 1; //int qq = Integer.MAX_VALUE; int qq = readInt(); long ret = 0; for(int casenum = 1; casenum <= qq; casenum++) { ret += solve(readLong()); } pw.println(ret); exitImmediately(); } static Map dp = new HashMap(); public static long solve(long x) { if(x == 1) return 1; if(dp.containsKey(x)) return dp.get(x); long ret = 0; for(long i = 1; i * i <= x; i++) { if(x%i != 0) { continue; } if(i != 1) { ret = Math.max(ret, 1 + i * solve(x / i)); } ret = Math.max(ret, 1 + (x/i) * solve(i)); } dp.put(x, ret); return ret; } private static void exitImmediately() { pw.close(); System.exit(0); } private static long readLong() throws IOException { return Long.parseLong(nextToken()); } private static double readDouble() throws IOException { return Double.parseDouble(nextToken()); } private static int readInt() throws IOException { return Integer.parseInt(nextToken()); } private static String nextLine() throws IOException { if(!br.ready()) { exitImmediately(); } st = null; return br.readLine(); } private static String nextToken() throws IOException { while(st == null || !st.hasMoreTokens()) { if(!br.ready()) { exitImmediately(); } st = new StringTokenizer(br.readLine().trim()); } return st.nextToken(); } }