#include <bits/stdc++.h>
#define ll long long
using namespace std;

ll longestSequence(vector <ll> a) {
    //  Return the length of the longest possible sequence of moves.
    ll sum=0;
    for(int i=0; i<a.size(); ++i)
    {
        ll x=a[i], ans=0;
        for(ll j=2; j*j<=x; ++j)
            while(x%j==0)
            {
                x/=j;
                ans+=x; 
            }
        if(x!=1)ans+=1;
        ans+=a[i];
        sum+=ans;
    }
    return sum;
}

int main() {
    int n;
    cin >> n;
    vector<ll> 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;
}