//>>>BaZ<< dp = new HashMap(); static ArrayList factors; static long i; public static void main(String[] args){ new Thread(null,null,"BaZ",99999999) { public void run() { try { solve(); } catch(Exception e) { e.printStackTrace(); System.exit(1); } } }.start(); } static void solve() throws IOException { Calendar CAL1 = Calendar.getInstance(); CAL1.setTime(new Date()); scan = new Reader(); //scan = new MyFileReader(); //ss = new MyFileReader1(); pw = new PrintWriter(System.out,true); //pw = new PrintWriter(new File("C://Users/Aman deep/Desktop/output.txt")); StringBuilder sb = new StringBuilder(); long sum = 0; int t = ni(); while(t-->0) { long n = nl(); i=2; sum+=my(n); } pl(sum); Calendar CAL2 = Calendar.getInstance(); CAL2.setTime(new Date()); double Execution_Time = (double)(CAL2.getTimeInMillis()-CAL1.getTimeInMillis())/1000.000; //System.out.println("Execution time : "+Execution_Time+" seconds"); pw.flush(); pw.close(); } static long my(long n) { if(n==1) return 1; for(;i*i<=n;++i) { if(n%i==0) { return n+my(n/i); } } return 1+n; } static long f(long n) { if(n==1) return 1; Long val = dp.get(n); if(val!=null) return val; long max = 0; for(long e:factors) { if(e*e>n) break; if(n%e==0) { if(e>1) max = max(max,1+e*f(n/e)); if(e*e!=n) max = max(max,1+(n/e)*f(e)); } } dp.put(n,max); return max; } static boolean islong(double d) { return Math.ceil(d)==d; } static double roundLikeCpp(double d,double precision) { if(islong(d)) return d; d*=(long)pow(10,precision+1); if(d%10==5) d--; return d/pow(10,precision+1); } static class Reader { final private int BUFFER_SIZE = 1 << 16; private DataInputStream din; private byte[] buffer; private int bufferPointer, bytesRead; public Reader() { din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public Reader(String file_name) throws IOException { din = new DataInputStream(new FileInputStream(file_name)); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String readLine() throws IOException { byte[] buf = new byte[64]; int cnt = 0, c; while ((c = read()) != -1) { if (c == '\n') break; buf[cnt++] = (byte) c; } return new String(buf, 0, cnt); } public int nextInt() throws IOException { int ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public long nextLong() throws IOException { long ret = 0; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) return -ret; return ret; } public double nextDouble() throws IOException { double ret = 0, div = 1; byte c = read(); while (c <= ' ') c = read(); boolean neg = (c == '-'); if (neg) c = read(); do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10); if (neg) return -ret; return ret; } private void fillBuffer() throws IOException { bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); if (bytesRead == -1) buffer[0] = -1; } private byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; } public void close() throws IOException { if (din == null) return; din.close(); } } static class MyFileReader //File input template { StringTokenizer st; BufferedReader br; MyFileReader() throws IOException { br = new BufferedReader(new FileReader("C://Users/Aman deep/Desktop/input.txt")); } String nextLine() throws IOException { return br.readLine(); } String next() throws IOException { if(st==null || !st.hasMoreTokens()) st = new StringTokenizer(nextLine()); return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(next()); } long nextLong() throws IOException { return Long.parseLong(next()); } double nextDouble() throws IOException { return Double.parseDouble(next()); } } static class MyFileReader1 //File input template { StringTokenizer st; BufferedReader br; MyFileReader1() throws IOException { br = new BufferedReader(new FileReader("C://Users/Aman deep/Desktop/output.txt")); } String nextLine() throws IOException { return br.readLine(); } String next() throws IOException { if(st==null || !st.hasMoreTokens()) st = new StringTokenizer(nextLine()); return st.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(next()); } long nextLong() throws IOException { return Long.parseLong(next()); } double nextDouble() throws IOException { return Double.parseDouble(next()); } } }