#include using namespace std; const int MAXN = 1e5 + 5; int n, a[MAXN], dp[MAXN], ans; int main(){ ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++){ cin >> a[i]; } for (int i = 1; i <= n; i++){ int tmp = dp[a[i]]; for (int j = 1; j * j <= a[i]; j++){ if (a[i] % j == 0){ dp[a[i]] = max({dp[a[i]], dp[j] + 1, dp[a[i] / j] + 1}); } } dp[a[i]] = max(dp[a[i]], 1); ans = max(ans, dp[a[i]]); } cout << ans; return 0; }//