#include using namespace std; #define REP(i, n) for (int i = 0; i < int(n); ++i) #define REPE(i, a, b) for (int i = (a); i <= int(b); ++i) #define SZ(x) ((int)(x).size()) #define ALL(x) x.begin(), x.end() #define PB push_back #define EB emplace_back using LL = long long; using PII = pair; #define F first #define S second void R(int &x) { scanf("%d", &x); } void R(LL &x) { scanf("%lld", &x); } void R(double &x) { scanf("%lf", &x); } template void R(T &t) { cin >> t; } template void R(vector &ar) { for (auto &it : ar) R(it); } template void R(T &t, Args &... args) { R(t); R(args...); } LL f(LL x) { vector a; for (LL i = 2; i * i <= x; ++i) { while (x % i == 0) { a.PB(i); x /= i; } } if (x > 1) a.PB(x); LL sum = 1, now = 1; reverse(ALL(a)); for (LL i : a) { now *= i; sum += now; } return sum; } int main() { int n; cin >> n; LL ans = 0; REP(i, n) { LL x; cin >> x; ans += f(x); } cout << ans << endl; return 0; }