#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
using namespace std;

typedef long long ll;

ll sol(ll x){
    if(x == 1) return 1;
    if(x == 2) return 3;
    if(x == 3) return 4;
    if(x == 5) return 6;
    if(x == 7) return 8;
    if(x % 2 == 0) return x + sol(x/2);
    ll h = sqrt(x);
    for(ll i = 3; i <= h; i+=2){
        if(x % i == 0) return x + sol(x/i);
    }
    return x + 1;
}


ll longestSequence(vector <ll> a) {
    ll ans = 0;
    for(ll i = 0 ;i < a.size(); i++){
        ans += sol(a[i]);
    }
    return ans;
}

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;
}