#include using namespace std; const int MAXN = 1e5 + 5; int n, a[MAXN], dp[MAXN]; 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]; dp[i] = 1; } int ans = -1; for (int i = 1; i <= n; i++){ for (int j = 1; j < i; j++){ if (a[i] % a[j] == 0){ dp[i] = max(dp[i], dp[j] + 1); } } ans = max(ans, dp[i]); } cout << ans; return 0; }