#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector dp((int)1e5 + 1, 0); int r = 0; for (int i = 0; i < n; i++) { int s = 0, t = a[i]; for (int j = 1; j * j <= t; j++) { if (t % j == 0) { s = max(s, max(dp[j], dp[t / j])); } } dp[t] = max(dp[t], s + 1); r = max(r, dp[t]); } cout << r << endl; return 0; }