#include #define rep(i,a,b) for(int i=int(a);i> N; vector V(N),cnt(MAX_V+1); rep(i,0,N){ cin >> V[i]; cnt[V[i]] = 1; } for(int i = MAX_V;i >= 1;i--){ if(!cnt[i])continue; int maxi = 0; for(int j = i * 2;j <= MAX_V;j += i){ maxi = max(maxi, cnt[j]); } cnt[i] = max(cnt[i], maxi + 1); } int maxi = 0; rep(i,1,MAX_V+1)maxi = max(maxi, cnt[i]); cout << maxi << endl; }