#include using namespace std; vector primes; long calc(long a){ long rv = 1; long base = 1; long mul=0; while(base < a){ long tmp = a/base; while(mul < primes.size() && (tmp % primes[mul]) != 0){ ++mul; } if(mul == primes.size()){ rv += tmp; break; } rv+=a/base; // cout << tmp << " " << a/primes[mul] << " " << base*primes[mul]<<" " < a) { long rv = 0; for(auto v : a) rv += calc(v); // Return the length of the longest possible sequence of moves. return rv; } int main() { vector pp(1000000, true); for (int p=2; p*p<=pp.size(); p++) { // If prime[p] is not changed, then it is a prime if (pp[p] == true) { // Update all multiples of p for (int i=p*2; i<=pp.size(); i += p) pp[i] = false; } } for(int i=2;i> 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; }