#include using namespace std; const int MAXV = 100001; int n, dp[MAXV], ans; void C(int x) { for(int i = 1; i * i <= x; ++i) { if(x % i == 0) { dp[x] = max({dp[x], dp[i] + 1, dp[x / i] + 1}); } } } int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n; for(int i = 1, x; i <= n; ++i) { cin >> x; C(x); ans = max(ans, dp[x]); } cout << ans; return 0; }