#define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(v) v.begin(), v.end() typedef long long ll; #include using namespace std; const int MAX=1e6; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector A(MAX+1),dp(MAX+1); rep(i,n){ int x; cin>>x; A[x]=1; dp[x]=1; } for(int i=1;i<=MAX;i++){ if(A[i]){ for(int j=2*i;j<=MAX;j+=i) dp[j]=max(dp[j],dp[i]+1); } } int ma=0; for(int i=1;i<=MAX;i++){ if(A[i]) ma=max(ma,dp[i]); } cout<