#include using namespace std; vector decompose(const vector& primes, long a) { vector ret; for (auto p: primes) { if (p*p > a) break; while (a % p == 0) { ret.push_back(p); a /= p; } } if (a > 1) ret.push_back(a); return ret; } long longestSequence(const vector& primes, long a) { if (a == 1) return 1; auto dec = decompose(primes, a); long ret = 1; for (auto d: dec) ret = d*ret+1; return ret; } long longestSequence(const vector & a) { if (a.empty()) return 0; auto max = *max_element(a.begin(), a.end()); vector is_prime(sqrt(max)+1, true); is_prime[0] = is_prime[1] = false; for (long i = 2; 2*i < is_prime.size(); ++i) for (long j = 2; j*i < is_prime.size(); ++j) is_prime[i*j] = false; vector primes; for (unsigned i = 2; i < is_prime.size(); ++i) if (is_prime[i]) primes.push_back(i); long ret = 0; for (auto n: a) ret += longestSequence(primes, n); return ret; } 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; }