import java.util.Scanner; public class Solution { static long alg(long n){ if(n==1l) return 1l; long m = 1; while((n&1l)==0l){m=(m<<1)|1l; n>>=1;} while(n%3l==0l){m=(m*3l)+1l; n/=3l;} long i=5l; while(n!=1){ while(n%i==0){m=(m*i)+1l; n/=i;} i+=2; while(n%i==0){m=(m*i)+1l; n/=i;} i+=4; if(n!=1 && i*i>n){m=(m*n)+1l; n=1;} } return m; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long result=0; while(n!=0){ --n; result += alg(in.nextLong()); } System.out.println(result); in.close(); } }