#include #include using namespace std; #define ll int64_t #define vi vector < int > #define vs vector < string > #define mp make_pair bool isPrime(ll n) { if (n <= 1) return false; if (n <= 3) return true; if (n%2 == 0 || n%3 == 0) return false; for (ll i=5; i*i<=n; i=i+6) if (n%i == 0 || n%(i+2) == 0) return false; return true; } int main() { //sieve(); int n; cin >> n; ll ans = 0; while(n--) { ll c; cin >> c; ll sum = c; while(c > 1) { if( c % 2 != 0) { if(isPrime(c)) { sum += 1; c = 1; break; } else { for(int i = 3; i < c/2; i += 2) { if(c % i == 0) { sum += c / i; c /= i; break; } } } } else { sum += c / 2; c /= 2; } } ans += sum; } cout << ans; return 0; }