#include using namespace std; typedef long long ll; int ar[1000001]; int is[1000001]; vectorpr; int check(ll n) { int fl=0; for (int j = 0; j < pr.size(); ++j) { if(n%pr[j]==0) { fl=1;break; } } return 1-fl; } ll longestSequence(vector a) { int N = 1000001; for (int i = 0; i < N; ++i) { is[i]=1; } for (int i = 2; i*i < N; ++i) { if(is[i]==1) { for (int j = 2*i; j < N; j+=i) { is[j]=0; } } } is[1]=0; is[0]=0; for (int i = 2; i < N; ++i) { if(is[i]==1) { pr.push_back(i); } } ll ans = 0; for (int i = 0; i < a.size(); ++i) { vectorval; int fl=0; ll x = a[i]; if(a[i]==1) { ans++; continue; } if(check(a[i])==1) { ans += (1+a[i]); continue; } for (int j = 0; j < pr.size(); ++j) { if(x%pr[j]==0) { while(x>1 and x%pr[j]==0) { x=x/pr[j]; val.push_back(pr[j]); } if(x>=N and check(x)==1) { val.push_back(x); x=1; } } if(x==1) break; } sort(val.begin(), val.end()); ll ans1 = 1; for (int j = 0; j < val.size(); ++j) { ans1 = 1 + val[j]*(ans1); } ans += ans1; } return ans; } int main() { int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } ll result = longestSequence(a); cout << result << endl; return 0; }