#include using namespace std; long long getAns(long long val){ if(val == 1){ return 1; } long long max = 1 + val ; for(int i = 2; i*i<=val;i++){ if(val%i==0){ long long tmp = 1+getAns(val/i) * i; if(tmp>max){ max = tmp; } tmp = 1+getAns(i) * (val/i); if(tmp>max){ max = tmp; } } } return max; } long long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. long long ans = 0; for(int i=0;i> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } long long result = longestSequence(a); cout << result << endl; return 0; }