#include using namespace std; using ll = long long; ll solve(ll n) { ll tmp = n; vector fs; for (ll i = 2; i * i <= tmp; i++) { while (tmp % i == 0) { tmp /= i; fs.push_back(i); } } if (tmp > 1) fs.push_back(tmp); sort(fs.rbegin(), fs.rend()); ll res = 1; tmp = 1; for (auto f : fs) { tmp *= f; res += tmp; } return res; } int main() { int n; ll res = 0; cin >> n; for (int i = 0; i < n; i++) { ll a; cin >> a; res += solve(a); } cout << res << endl; return 0; }