#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000 + 10;
int dp[MAXN], N, x;
int main() {
  while (scanf("%d", &N) != EOF) {
    memset(dp, 0, sizeof(dp));
    int ans = 0;
    for (int i = 1; i <= N; i++) {
      scanf("%d", &x);
      dp[x] += 1;
      ans = max(ans, dp[x]);
      for (int j = 2 * x; j <= 1000000; j += x) dp[j] = max(dp[j], dp[x]);
    }
    cout << ans << endl;
  }
  return 0;
}
