#include using namespace std; const int N = 1e5 + 10; int n, dp[N]; vector g[N]; int main() { for(int i = N - 1; i > 0; i --) for(int j = i; j < N; j += i) g[j].push_back(i); cin >> n; for(int i = 1, x; i <= n; i ++) { cin >> x; for(int v : g[x]) dp[x] = max(dp[x], dp[v] + 1); } cout << *max_element(dp + 1, dp + N); }