#include using namespace std; typedef long long ll; ll f(ll x){ vector divs; for(ll i = 2; i*i <= x; ++i) while(x%i == 0){ divs.push_back(i); x /= i; } if(x > 1) divs.push_back(x); ll cur = 1; sort(divs.rbegin(),divs.rend()); ll ans = 0; for(ll x : divs){ ans += cur; cur *= x; } ans += cur; return ans; } int main(){ int n; cin >> n; vector arr(n); for(int i = 0; i < n; ++i) cin >> arr[i]; ll ans = 0; for(ll x : arr) ans += f(x); cout << ans << '\n'; }