#include using namespace std; long long int count(long long int a) { // suppose we have 'a' 1-sized sticks. To maximize the number of moves we need to unite them in the smallest possible sticks so that the newly-acquired sticks can together form the stick of size 'a' for (long long int i = 2; i * i <= a; ++i) { if (a % i == 0) { // we have found such size of a chocolate return a + count(a / i); } } // if a is prime, then we break it into a pieces and then it takes a moves to eat them return 1 + a; } int main() { int n; cin >> n; long long int ans = 0; long long int a; for (int i = 0; i < n; ++i) { cin >> a; if (a != 1) { ans += count(a); } else { ++ans; } } cout << ans; return 0; }