#define problem "Breaking Sticks"
#include <bits/stdc++.h>
#define Z (1 - 1)
using namespace std;
map<long long, long long > mp;

long long f(long long x){
    /*if(mp.find(x) != mp.end()) return mp[x];
    if(x == 1) return 1;
    long long res = Z;
    for(int i = 1; 1ll * i * i <= x; i++) if(x % i == Z){
        if(i > 1) res = max(res, 1 + i * f(x / i));
        res = max(res, 1 + x / i * f(i));
    }
    return mp[x] = res;*/
    long long res = 1;
    for(int i = 2; 1ll * i * i <= x; i++) if(x % i == Z){
        while(x % i == Z){
            res += x;
            x /= i;
        }
    }
    if(x > 1) res += x;
    return res;
}

int main(){
    int N;
    cin >> N;
    long long ans = Z;
    while(N--){
        long long x;
        cin >> x;
        ans += f(x);
    }
    cout << ans;
}