#include #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; constexpr double PI = 3.14159265358979323846; const int MX = 300005; int dp[MX]; int main(){ int n; cin >> n; vector a(n); rep(i,n) cin >> a[i]; sort(a.begin(),a.end()); rep(i,n){ for(int j=1;j*j<=a[i];j++){ dp[a[i]] = max(dp[a[i]],1); if(a[i]%j==0){ if(j!=a[i]) dp[a[i]] = max(dp[a[i]],dp[j]+1); if(j!=1) dp[a[i]] = max(dp[a[i]],dp[a[i]/j]+1); } } } int mx = 0; rep(i,MX) mx = max(mx,dp[i]); cout << mx << endl; return 0; }