#include #include #include #define REP(i,n) for ((i)=0; (i) < (n); (i)++ ) #define REV(i,n) for ((i)=(n)-1; (i) >= 0; (i)-- ) typedef long long ll; using namespace std; vector factor(ll x) { vector factors; ll orig_x = x; ll i=2; while (x % i == 0 && x > 1) { factors.push_back(i); x /= i; } i = 3; while (i*i <= orig_x && x > 1) { while (x % i == 0 && x > 1) { factors.push_back(i); x /= i; } i += 2; } if (x > 1) factors.push_back(x); return factors; } ll getMoves(ll x) { if (x == 1) { return 1; } else { vector factors = factor(x); int n = factors.size(); int i; ll ans = 1; ll prod = 1; if (n <= 1) { ans += x; } else { REV(i, n) { prod *= factors[i]; ans += prod; } } return ans; } } ll solve(vector a) { ll totalmoves = 0; int n = a.size(); int i; REP(i, n) totalmoves += getMoves(a[i]); return totalmoves; } int main() { int i,n; cin >> n; vector a(n); REP(i, n) cin >> a[i]; cout << solve(a) << endl; return 0; }