#include <bits/stdc++.h>
using namespace std;
int dp[1000000 + 5], a;
int main() {
  int n, maxs;
  while (~scanf("%d", &n)) {
    memset(dp, 0, sizeof(dp));
    maxs = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a);
      dp[a]++;
      maxs = max(maxs, dp[a]);
      for (int j = a * 2; j <= 1000000; j += a) dp[j] = max(dp[j], dp[a]);
    }
    printf("%d\n", maxs);
  }
}
