#include #include #include #include constexpr int MAX_N = 105; using namespace std; using ll = long long; int n; ll arr[MAX_N]; // answer for 2^1 = 3 // answer for 2^2 = 7 // answer for 2^3 = 15 // answer for 2^4 = 31 // answer for 3^1 = 4 // answer for 3^2 = 13 // answer for 3^3 = 40 // answer for 3^4 = 121 vector> factors(ll x) { unordered_map pf; for (ll i = 2; i * i <= x; ++i) { while (x % i == 0) { ++pf[i]; x /= i; } } if (x > 1) ++pf[x]; vector> ans; for (pair f : pf) { ans.push_back(f); } sort(ans.begin(), ans.end()); return ans; } ll solve(ll x) { vector> pf = factors(x); vector dp; dp.push_back(1); for (pair f : pf) { ll last = dp.back(); for (int i = 0; i < f.second; ++i) { last = 1 + last * f.first; } dp.push_back(last); } return dp.back(); } int main() { scanf(" %d", &n); ll ans = 0; for (int i = 0; i < n; ++i) { scanf(" %lld", &arr[i]); ans += solve(arr[i]); } printf("%lld\n", ans); return 0; }