#include <bits/stdc++.h>
const int maxn = 1500000;
inline int max(int a, int b) { return a > b ? a : b; }
int a, n, m;
int k[maxn];
int main() {
  scanf("%d", &n);
  m = 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a);
    k[a] = 1;
  }
  int tmp = a;
  for (int i = 1; i <= tmp; ++i)
    if (k[i])
      for (int a = 2 * i; a <= tmp; a += i)
        if (k[a]) {
          k[a] = max(k[a], k[i] + 1);
          m = max(m, k[a]);
        }
  printf("%d\n", m);
  return 0;
}
