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 s=a; int j=0; while(a%2==0) { a/=2; s+=a; } for(j=3; j<=Math.sqrt(a); j+=2) { while(a%j==0) { a/=j; s+=a; } } if(s!=1) s+=1; return s; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] a = new long[n]; long sum=0; for(int a_i = 0; a_i < n; a_i++){ a[a_i] = in.nextLong(); sum+=longestSequence(a[a_i]); } System.out.println(sum); in.close(); } }