#include using namespace std; #define rep(i,a,b) for(int i=a;i> n; vector arr; rep(i,0,n){ int t; cin >> t; arr.push_back(t); } map mp; rep(i,0,n){ mp[arr[i]] = 1; } sort(arr.begin(),arr.end()); for(auto e:arr){ int i = 2; int t = mp[e]; while(e*i < 1e6+1){ if(mp.find(e*i) != mp.end()){ mp[e*i] = max(mp[e*i], t+1); } i++; } } int m = 0; for(auto e:mp){ m = max(m, e.second); } cout << m << endl; }