//Priyanshu Kumar : IIIT Allahabad
#include<bits/stdc++.h>
using namespace std;

#define ull unsigned long long int
#define ll long long int
#define MAX 1000005
#define MOD 1000000007
#define sz size()
#define ln length()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define sl(n) scanf("%lld",&n)
#define pi(n) printf("%d",n)
#define pin(n) printf("%d\n",n);
#define pl(n) printf("%lld",n)
#define pln(n) printf("%lld\n",n);
#define FUCK_YEAH ios_base::sync_with_stdio(false);cin.tie(NULL)
inline ll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);}
inline ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
inline ll powmod(ll a,ll b,ll mod) 
{
    ll res=1;
    a%=mod; 
    assert(b>=0); 
    for(;b;b>>=1)
    {
        if(b&1)res=res*a%mod;
        a=a*a%mod;
    }
    return res;
}
inline ll mulmod(ll a, ll b, ll c)
{
    if(!b)return 0;
    ll x = mulmod(a, b/2, c);
    if (b & 1)return (x+x+a)%c;
    return (x+x)%c;
}

vector <int> v;
int isP[MAX];
 
void sieve()
{
    int i, j;
    for (i = 2; i <= 1000000; ++i) {
        if (!isP[i]) {
            v.pb(i);
            for (j = 2; i*j <= 1000000; ++j)
                isP[i*j] = 1;
        }
    }
}

int main()
{
    FUCK_YEAH;
    sieve();
    ll n, x, ans = 0, cur, val;
    cin >> n;
    for(int i = 0; i < n; i++) {
        cin >> x;
        cur = x;
        val = 1;
        ans += x;
        for(int j = 0; j < v.size(); j++) {
            while(cur%v[j] == 0) {
                val *= v[j];
                ans += (x/val);
                cur/= v[j];
            }
        }
        if(cur != 1) {
            val *= cur;
            ans += (x/val);
        }
    }
    cout << ans << endl;
    return 0;
}