#include #include #include using namespace std; int main(){ int n; cin >> n; vector dp(300001, 0); for(int i = 0; i < n; i++){ int x; cin >> x; for(int i = 1; i*i <= x; i++){ if(x%i) continue; dp[x] = max(dp[x/i]+1, dp[x]); if(i==1) continue; dp[x] = max(dp[i]+1, dp[x]); } } cout << *max_element(dp.begin(),dp.end()) << endl; return 0; }