import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long longestSequence(long[] a,int n) { long ans=0; long arr[]=new long[1000000]; int top=-1; arr[++top]=2; for(int i=3;i<1000005;i++) { int flag=1; for(int j=0;j<=top&&arr[j]*arr[j]<=i;j++) { if(i%arr[j]==0) { flag=0; break; } } if(flag==1) { arr[++top]=i; } } for(int i=0;i=0;j--) { while(a[i]%arr[j]==0) { prev*=arr[j]; temp+=prev; a[i]/=arr[j]; } } if(a[i]!=1) { temp=a[i]; a[i]=prev; prev=temp; temp++; for(int j=top;j>=0;j--) { while(a[i]%arr[j]==0) { prev*=arr[j]; temp+=prev; a[i]/=arr[j]; } } } ans+=temp; } return ans; } 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,n); System.out.println(result); in.close(); } }