#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m = 100000; cin >> n; vector> tb(m + 1); for(int i = 1; i <= m; i++){ for(int j = i; j <= m; j += i){ tb[j].push_back(i); } } vector a(n); for(auto &&v:a)cin >> v; vector dp(m + 1); for(int i = 0; i < n; i++){ int mx = 0; for(auto &&v:tb[a[i]]){ mx = max(mx, dp[v]); } dp[a[i]] = mx + 1; } cout << *max_element(dp.begin(), dp.end()) << '\n'; }