#include using namespace std; typedef long long ll; #define N 110 ll a[N]; vector v; map mp; vector pri; ll val[N * 10000]; int cnt = 0; ll calc(ll n) { if(n == 1) { return 1; } ll id = mp[n]; if(id > 0) { return id; } ll ans = 1 + n; for(int i = 0; i < pri.size(); i ++) if(n % pri[i] == 0){ ll xx = calc(n / pri[i]); ll ans1 = 1 + pri[i] * xx; if(ans < ans1) ans = ans1; } mp[n] = ans; return ans; } int main() { //freopen("1.in", "r", stdin); int T; int n; scanf("%d", &n); ll ans = 0; for(int i = 0; i < n; i ++) scanf("%lld", &a[i]); v.clear(); for(int i = 0; i < n; i ++) { ll x = a[i]; for(int j = 2; 1ll * j * j <= x; j ++) if(x % j == 0) { while(x % j == 0) { x /= j; } v.push_back(j); } if(x > 1) v.push_back(x); } sort(v.begin(), v.end()); pri.clear(); mp.clear(); //pri.push_back(v[0]); for(int i = 0; i < v.size(); i ++) { if(i && v[i] == v[i - 1]) { continue; } pri.push_back(v[i]); } for(int i = 0; i < pri.size(); i ++) { //printf("%I64d ", pri[i]); } //puts(""); v.clear(); for(int i = 0; i < n; i ++) { ll ans1 = calc(a[i]); //printf("%I64d\n", ans1); ans += ans1; } printf("%lld\n", ans); return 0; }