using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static long mindiv(long l) { long m = (long)Math.Sqrt(l); for(long i = 2; i <= m; i++) if(l%i == 0) return i; return l; } static long calc(long l) { if(l==1) return 1; long L = l; long s = L; long n = 1; long sz = l; do{ long d = mindiv(l); l = l/d; s += l; } while( l > 1); //Console.WriteLine(s); return s; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long sum = 0; for(int i = 0; i < a.Length; i++) sum += calc(a[i]); return sum; } static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); string[] a_temp = Console.ReadLine().Split(' '); long[] a = Array.ConvertAll(a_temp,Int64.Parse); long result = longestSequence(a); Console.WriteLine(result); } }