#include <bits/stdc++.h>
using namespace std;
const int N = 1000001;
const int oo = 1 << 29;
int dp[N];
int n, a[N], res;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    ++dp[a[i]];
    for (int j = a[i] + a[i]; j < N; j += a[i]) dp[j] = max(dp[j], dp[a[i]]);
    res = max(res, dp[a[i]]);
  }
  printf("%d\n", res);
  return 0;
}
