/* ID: usaco.t3 TASK: test LANG: C++14 */ #pragma GCC optimize ("O3") /****Author: Barish Namazov****/ #include using namespace std; /***TEMPLATE***/ #define intt long long #define pii pair #define vi vector #define vii vector #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define IO ios_base::sync_with_stdio(false);cin.tie(); #define endl '\n' #define wtfis(x) cerr << "at line " << __LINE__ << ": " << #x << " = " << (x) << endl const intt max3 = 1003; const intt max4 = 10004; const intt maxx = 100005; const intt max6 = 1000006; const intt max7 = 10000007; const intt lg4 = 13; const intt lg5 = 17; const intt lg6 = 20; const intt INF = 2LL * 1000000000; const intt INFLL = 9LL * 1000000000 * 1000000000; /***************/ intt powmod (intt a, intt b, intt mod) { intt res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1) res = (res * a) % mod; a = (a * a) % mod; } return res; } intt gcd (intt a, intt b) { while (b > 0) { intt t = a % b; a = b, b = t; } return a; } intt lcm (intt a, intt b) { return (a / gcd (a, b)) * b; } intt is_prime (intt n) { if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0)) return 0; for (intt i = 5, t = 2; i * i <= n; i += t, t = 6 - t) if (n % i == 0) return 0; return 1; } /**************************/ int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); IO; intt n, x, tot = 0; cin >> n; for (intt c = 1; c <= n; c++) { cin >> x; if (x == 1) { tot += 1; continue; } intt res = 0, xx = x, xxx, tmp; vector v; for (intt i = 2; i * i <= x; i++) { if (x % i == 0) { intt cnt = 0; while (x % i == 0) { x /= i, cnt++; } v.pb ({i, cnt}); } } //cout << x << endl; if (x > 1) { v.pb ({x, 1}); } x = xx;/* for (intt i = 0; i < v.size(); i++) { cout << v[i].F << " " << v[i].S << endl; }*/ intt mul = 1; intt sz = v.size(); for (intt i = sz - 1; i >= 0; i--) { intt cnt = v[i].S; while (cnt --) { x /= v[i].F; res += mul, /*cout << mul << endl,*/ mul *= v[i].F; } } res += mul; /*cout << mul << endl;*/ /*cout << res << endl;*/ tot += res; } cout << tot << endl; return 0; }