#include #define ll long long #define fin(x) scanf("%lld",&x) #define fout(x) printf("%lld\n",x) #define pll pair #define mp(x,y) make_pair(x,y) #define cases int t; scanf("%d",&t); while(t--) #define MOD 1000000007 #define MAXN 123456 #define read() freopen("dede.txt", "r", stdin) #define write() freopen("dede.txt", "w", stdout) using namespace std; int main() { ll n, ans = 0; fin(n); ll ar[n]; for(ll i = 0; i < n; i++) fin(ar[i]); for(ll i = 0; i < n; i++) { ll x = ar[i]; set st; set st1; ll ki = 0; if(x % 2 == 0) { while(x % 2 == 0) { ki++; x /= 2; } st.insert(pll(ki, 2)); } for(ll j = 3; j <= sqrt(x); j += 2) { ki = 0; if(x % j == 0) { x /= j; ki++; } if(ki) { st.insert(pll(ki, j)); } } if(x > 2) st.insert(pll(1, x)); ll mx = -1, pr; for(auto it : st) mx = max(mx, it.first); for(auto it : st) { if(it.first == mx) { pr = it.second; break; } } ll temp = 1; st1.insert(temp); for(ll j = 1; j <= mx; j++) { temp *= pr; st1.insert(ar[i] / temp); } ll sum = 0; st1.insert(ar[i]); for(auto it : st1) { sum += it; ans += it; } } fout(ans); return 0; }