#include using namespace std; map mp; long fun(long n) { if(n==1) return 1; long ans=0,p; if(mp.find(n)!=mp.end()) return mp[n]; int isprime=1; for(p=2;p*p<=n;p++) { if(n%p==0) { isprime=0; ans=max(ans,max(p*fun(n/p)+1,n/p*fun(p)+1)); } } if(isprime) ans=n+1; return mp[n]=ans; } long longestSequence(vector a) { // Return the length of the longest possible sequence of moves. 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 result = longestSequence(a); cout << result << endl; return 0; }