#include using namespace std; vector st(10000001); long fun(long n) { long maxi=0; long t; if(st[n]!=0) { //cout<<"h"; return st[n]; } for(int i=2;i<=n;i++) { //cout<<"n"<<" "; if(n%i==0) { t=i*fun(n/i)+1; if(t>maxi) { maxi=t; } } } st[n]=maxi; return maxi; } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. int sum=0; for(int i=0;i> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } st[1]=1; long result = longestSequence(a); cout << result << endl; return 0; }