#include using namespace std; #define ll long long #define f(i, x, n) for(int i = x; i < (int)(n); ++i) ll go(ll t){ vector d; for (int i = 2; (ll)i * i <= t; ++i)if (t % i == 0){ t /= i; d.push_back(i); while (t % i == 0)t /= i, d.push_back(i); } if (t > 1)d.push_back(t); ll an = 0, s = 1; for (int i = d.size() - 1; i >= 0; --i){ an += s; s *= d[i]; } return an + s; } int main(){ int n; scanf("%d", &n); ll an = 0; f(i, 0, n){ ll t; scanf("%lld", &t); an += go(t); } printf("%lld\n", an); }