#include using namespace std; const int N = 300300; int dp[N]; int main(void){ int n; cin >> n; for(int i = 1; i < N; i++) dp[i] = 0; int a, ma, ans = 0; for(int i = 0; i < n; i++){ cin >> a; if(a == 1) ma = 1; else if(dp[1] + 1 > dp[a]) ma = dp[1] + 1; else ma = dp[a]; for(int i = 2; i * i <= a; i++){ if(a % i == 0){ if(dp[i] + 1 > ma) ma = dp[i] + 1; if(dp[a / i] + 1 > ma) ma = dp[a / i] + 1; } } dp[a] = ma; if(ma > ans) ans = ma; } cout << ans << "\n"; }