#include using namespace std; using ll = long long; map memo; ll solve(ll x) { if (memo.find(x) != end(memo)) return memo[x]; ll orig = x; ll ans = 0LL; for (ll d = 2; x > 1 and d * d <= x; ++d) { while (x % d == 0) { ans += x / d; x /= d; } } if (x > 1) ++ans; // printf("solve(%lld) = %lld\n", orig, ans); return memo[orig] = ans; } int main() { int n; cin >> n; vector a(n); ll ans = 0LL; memo[1] = 0; for (int i = 0; i < n; i++) { cin >> a[i]; ans += solve(a[i]); ans += a[i]; // printf("%lld ", solve(a[i]) - a[i]); } // printf("\n"); printf("%lld\n", ans); return 0; }