#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
#define all(a) a.begin(), a.end()
#define forlr(l, r) for(int i = (int)l; i <= (int)r; i++)
#define forrl(l, r) for(int i = (int)r; i >= (int)l; i--)
#define pii pair<int, int>
#define ld long double
#define vii vector<pii >
#define F first
#define S second
using namespace std;
const int N = 300000;
vector<pair<int, int> > g[N];
bool bri[N], mark[N];
int tin[N], fup[N], timer, comp[N];
vector<int> comps;
set<int> g1[N];

void FB(int u, int p)
{
    mark[u] = 1;
    tin[u] = fup[u] = timer++;
    for(auto to : g[u])
    {
        if(mark[to.F] == 0)
        {
            FB(to.F, u);
            fup[u] = min(fup[u], fup[to.F]);
            if(fup[to.F] > tin[u])
            {
                bri[to.S] = 1;
            }
        }
        else if (to.F != p)
        {
            fup[u] = min(fup[u], tin[to.F]);
        }
    }
}

int dfs(int u)
{
    if(mark[u])
    {
        return 0;
    }
    mark[u] = 1;
    comp[u] = comps.size();
    int ans = 1;
    for(auto to : g[u])
    {
        if (bri[to.S] == 0)
        {
            ans += dfs(to.F);
        }
    }
    return ans;
}

int solve()
{
    int n;
    cin >> n;
    int ans = 0, now = n;
    for(int i = 2; i * i <= n; i++)
    {
        while(now % i == 0)
        {
            ans += now;
            now /= i;
        }
    }
    if(now > 1)
    {
        ans += now;
    }
    return ans + 1;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1, ans = 0;
    cin >> t;
    while(t--)
    {
        ans += solve();
    }
    cout << ans;
    return 0;
}