#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void amin(T &a, const T &b) {
  if (b < a) a = b;
}
template <class T>
inline void amax(T &a, const T &b) {
  if (a < b) a = b;
}
int N;
int A[1000111];
int C[1000111];
int main() {
  scanf("%d", &N);
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    scanf("%d", A + i);
  }
  sort(A, A + N);
  int ans = 0;
  for (int i = N - 1; i >= 0; i--) {
    if (i + 1 < N && A[i] == A[i + 1])
      C[A[i]]++;
    else {
      C[A[i]] = 0;
      for (int j = A[i]; j < 1000111; j += A[i]) amax(C[A[i]], C[j] + 1);
    }
  }
  for (int i = 0, i_len = (N); i < i_len; ++i) {
    amax(ans, C[A[i]]);
  }
  printf("%d\n", ans);
  return 0;
}
