#include using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; int ret = 1; vector len(300000+1, 1); for (int i = n-1; i >= 0; i--) { int x = a[i]; ret = max(ret, len[x]); for (int i = 1; i * i <= x; i++) { if (x % i) continue; int j = x / i; if (i < x) len[i] = max(len[i], len[x] + 1); if (j < x) len[j] = max(len[j], len[x] + 1); } } cout << ret << endl; return 0; }