#include using namespace std; /* void createPrimeVector(long n, vector &primes){ bool num[n + 1]; memset(num, true, sizeof(num)); for (long i = 2; i * i < n; i++){ if (num[i] == true){ primes.push_back(i); for (long j = i; j < n; j += i){ num[j] = false; } } } } */ long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long sum = 0; /* vector primes; createPrimeVector(1000000, primes); for (auto x : primes){ cout << x << " "; } */ for (auto x : a){ long moves = x; while(x % 2 == 0){ moves += (x / 2); //cout << "moves: " << moves << "\n"; x /= 2; } for (long i = 3; i * i < x + 1; i += 2){ while (x % i == 0){ moves += (x / i); //cout << "moves: " << moves << "\n"; x /= i; } } if (x > 2){ moves += 1; } //cout << "moves: " << moves << "\n"; sum += moves; } return sum; } int main() { int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } long result = longestSequence(a); cout << result << endl; return 0; }