#include #include #include #include #include #include #include #include #include #include #include #define MOD (1000000007l) #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) using namespace std; void solve() { ll N; cin >> N; unordered_map memo; rep (i, N) { ll A; cin >> A; if (A == 1) memo[1] = 1; else if (memo[A] == 0 or memo[A] == 1) memo[A] = memo[1] + 1; for (ll it = 2; it * it <= A; it++) { if (A % it) continue; ll tmp = max(memo[it] + 1, memo[A / it] + 1); if (tmp > memo[A]) memo[A] = tmp; } } ll ans = 0; for (auto it: memo) if (ans < it.second) ans = it.second; cout << ans << endl; } int main(void) { cin.tie(0); ios::sync_with_stdio(false); cout.precision(12); cout << fixed; solve(); return 0; }