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