#include using namespace std; typedef long long int LLI; map memo; bool comp[1111111]; vector primes; LLI longestSequence(vector a) { // Return the length of the LLIest possible sequence of moves. LLI res = 0, tmp; for (int i = 0; i < a.size(); ++i) { tmp = a[i]; for (int j = 0; j < primes.size(); ++j) { if (tmp % primes[j] == 0) { while (tmp % primes[j] == 0) { res += tmp; tmp /= primes[j]; } } if (tmp == 1) { res++; break; } } if (tmp != 1) res += tmp+1; } return res; } int main() { memo[1] = 1; memo[2] = 3; primes.push_back(2); for (int i = 3; i < 1e6; i += 2) { if (!comp[i]) { if (i < 1e3) { for (int j = i*i; j < 1e6; j += i) comp[j] = 1; } primes.push_back(i); memo[i] = i+1; } } int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } LLI result = longestSequence(a); cout << result << endl; return 0; }