#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); ll N; cin >> N; vector A(N); for (ll i = 0; i < N; i++) cin >> A[i]; vector dp(300005, 0); for (int i = 0; i < N; i++) { ll t = A[i], temp = 0; for (int j = 1; j <= sqrt(t); j++) { if (t % j) continue; ll f1 = j, f2 = t / j; if (f1 < t) temp = max(temp, dp[f1]); if (f2 < t) temp = max(temp, dp[f2]); } dp[t] = temp + 1; } ll ans = 0; for (int i = 0; i < 300005; i++) { ans = max(ans, dp[i]); } cout << ans << '\n'; return 0; }