#include #include #include typedef long long LL; #define REP(i, n) for (LL i = 0; i < (n); ++i) #define FOR(i, a, b) for (LL i = (a); i < (b); ++i) bool isp[1006020]; LL p[1000005], np, N; LL S; void computePrimes() { isp[0] = isp[1] = 1; FOR(i, 2, 1004) if (!isp[i]) for (LL j = i*i; j <= 1006009; j += i) isp[j] = 1; REP(i, 1006010) if (!isp[i]) p[np++] = i; } LL solve(LL n) { std::vector fv, pv; REP(i, np) { if (n == 1) break; if (!(n%p[i])) fv.push_back(0), pv.push_back(p[i]); while (!(n%p[i])) ++fv[fv.size()-1], n/=p[i]; } if (n != 1) fv.push_back(1), pv.push_back(n); std::reverse(fv.begin(), fv.end()); std::reverse(pv.begin(), pv.end()); LL ans = 1, prv = 1; REP(i, fv.size()) { REP(j, fv[i]) { prv *= pv[i]; ans += prv; } } return ans; } int main() { scanf("%lld", &N); LL ans = 0; computePrimes(); REP(i, N) { scanf("%lld", &S); ans += solve(S); } printf("%lld\n", ans); return 0; }