#include using namespace std; #define fi first #define se second #define pb push_back //#define FILE #define taskname "" #define taski taskname".in" #define tasko taskname".out" typedef long long ll; typedef unsigned int uint; vector p; long long big_prime(long long a) { for(int x : p) while(a % x == 0) a /= x; return a; } long long solve(long long a) { long long result = 0; long long pieces = 1; long long t = big_prime(a); if(t > 1) { result += pieces; pieces *= t; a /= t; } for(int i = p.size() - 1; i >= 0; i--) { int x = p[i]; while(a % x == 0) { result += pieces; pieces *= x; a /= x; } } //cout << pieces << endl; return result + pieces; } bool prime(int x) { for(int i = 0; i < p.size() && p[i] * p[i] <= x; i++) if(x % p[i] == 0) return false; return true; } void precalc() { for(int i = 2; i <= 1000000; i++) if(prime(i)) p.push_back(i); } int main() { ios:: sync_with_stdio(false); #ifdef HOME freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #elif defined(FILE) freopen(taski, "r", stdin); freopen(tasko, "w", stdout); #endif precalc(); int n; cin >> n; long long ans = 0; for(int i = 0; i < n; i++) { long long a; cin >> a; ans += solve(a); } cout << ans; return 0; }