#include #include #include #include #include #include #include #include #include #include #include #include #define vll vector #define vvv vector #define vvi vector > #define vvl vector > #define vv(a, b, c, d) vector >(a, vector(b, c)) #define vvvl(a, b, c, d) vector(a, vvl(b, vll (c, d))); #define rep(c, a, b) for(ll c=a;c> n; vll dp(300001, 0), a(n); re(i, n) std::cin >> a[i]; for(int i=n-1;i>=0;i--){ dp[a[i]]++; ans = max(ans, dp[a[i]]); for(int j=2;j*j<=a[i];j++){ if(a[i]%j==0){ dp[j] = max(dp[j], dp[a[i]]); dp[a[i]/j] = max(dp[a[i]/j], dp[a[i]]); } } } std::cout << ans << '\n'; return 0; }