// __author__ HD #include #define endl '\n' #define MAX 1000005 #define MOD 101 using namespace std; typedef long long ll; bool not_primes[MAX]; bool is_prime(ll a){ for (ll i = 2; i * i <= a ; ++i) { if(a % i == 0) return false; } return true; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); vector primes; for (int i = 2; i < MAX; ++i) { if (!not_primes[i]) { primes.push_back((ll) i); for (int j = i + i; j < MAX; j += i) { not_primes[j] = true; } } } int n; cin >> n; vector chocolats(n); for (int i = 0; i < n; ++i) cin >> chocolats[i]; ll total = 0ll; ll answer = 0ll; for (int i = 0; i < n; ++i) { ll aux = chocolats[i]; ll count = 1ll; if (is_prime(aux)) { answer += (aux == 1 ? 1 : aux + 1); } else { answer += 1ll; int j = 0; vector p; while (aux >= primes[j]) { if (aux % primes[j] == 0) { ll d = aux/primes[j]; if(is_prime(d)){ aux /= d; p.push_back(d); } aux /= primes[j]; p.push_back(primes[j]); } else j++; } sort(p.begin(), p.end()); for (int k = p.size() - 1; k >= 0; --k) { count *= p[k]; answer += count; } } } cout << answer << endl; return 0; }