#ifdef NACHIA #define _GLIBCXX_DEBUG #else #define NDEBUG #endif #include #include #include #include #include #include #include #include using i64 = long long; using u64 = unsigned long long; #define rep(i,n) for(int i=0; i=0; i--) const i64 INF = 1001001001001001001; #include using Modint = atcoder::static_modint<10000'00007>; using namespace std; void testcase(){ int N; cin >> N; vector A(N); rep(i,N) cin >> A[i]; vector> divs(300001); for(int i=1; i Q(300001, 0); for(int a : A){ int p = 0; for(int d : divs[a]) if(Q[d] > p) p = Q[d]; Q[a] = p; } int ans = *max_element(Q.begin(), Q.end()); cout << ans << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); testcase(); return 0; }