#include using namespace std; vector prime; map m; void sieve() { vector x; x.resize(1000005, 1); for (int i=2; i*i= curLen) break; if (curLen % prime[i] == 0) { m[curLen] = (long long int)(curLen / prime[i]) + rec(curLen / prime[i]); return m[curLen]; } } m[curLen] = 1; return 1; } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long long int total = 0; for (int i=0; i 1) total += rec(a[i]); } return total; } int main() { int n; cin >> n; sieve(); 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; }