#include <bits/stdc++.h>

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long

using namespace std;

const int N = (3e5), mod = (1e9) + 7;

ll x, d[N], dp[N];
int n, dn;

ll get(ll x){
	ll res = x;
	for(int i = 2; 1ll * i * i <= x; i++){
		if(x % i == 0){
			while(x % i == 0){
				x /= i;
				res += x;	
			}
		}
	}
	if(x > 1) res++;
	return res;
}

int main(){
	cin >> n;
	ll ans = 0;
	for(int i = 0; i < n; i++){
		cin >> x;
		ans += get(x);
	}
	cout << ans;
	
 	return 0;
}