#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000007; //10^9+7 vector enumdiv(int n){ vector s; for(int i=1;i*i<=n;i++){ if(n%i==0){ s.push_back(i); if(i*i!=n)s.push_back(n/i); } } sort(s.begin(),s.end()); return s; } int main(){ int n; cin>>n; int x[1000005]; REP(i,n)cin>>x[i]; int dp[1000005]; REP(i,n)dp[x[i]]=1; sort(x,x+n); REP(i,1000002){ if(dp[i]){ auto v=enumdiv(i); for(int j:v){ if(j!=i)dp[i]=max(dp[i],dp[j]+1); } } } int max_=0; //printall(440,dp); REP(i,n)max_=max(max_,dp[x[i]]); print(max_); }