#include #define me(a,x) memset(a,x,sizeof a) #define cp(a,x) memcpy(a,x,sizeof a) using namespace std; typedef long long LL; const int N=1e6,inf=1e9+7; char O[1<<14],*S=O,*T=O; #define gc (S==T&&(T=(S=O)+fread(O,1,1<<14,stdin),S==T)?-1:*S++) inline LL read(){ LL x=0,f=1; char ch=gc; while(ch<'0' || ch>'9'){if(ch=='-')f=-1; ch=gc;} while(ch>='0' && ch<='9'){x=(x<<1)+(x<<3)+(ch^48); ch=gc;} return x*f; } bool v[N+2]; int p[N/10],pl; void pre(){ for(int i=2;i<=N;++i){ if(!v[i]) p[++pl]=i; for(int j=1;j<=pl;++j){ if(1ll*i*p[j]>N)break; v[i*p[j]]=1; if(i%p[j]==0)break; } } } int main(){ int n=read(); LL ans=0; pre(); while(n--){ LL x=read(); ans+=x; for(int i=1;i<=pl;++i){ if(1ll*p[i]*p[i]>x)break; while(x%p[i]==0)x/=p[i],ans+=x; } if(x!=1)++ans; } printf("%lld\n",ans); return 0; }