#include <bits/stdc++.h>
using namespace std;
const int INF = (1LL << 30) - 1;
const long long int LINF = (1LL << 62) - 1;
const int VMAX = (int)(1e6);
int N;
int P[VMAX + 5];
int sol;
int main() {
  int i, j, x;
  cin.sync_with_stdio(false);
  scanf("%d", &N);
  for (i = 1; i <= N; i++) {
    scanf("%d", &x);
    P[x]++;
    sol = max(sol, P[x]);
    for (j = 2; j * x <= VMAX; j++) P[j * x] = max(P[j * x], P[x]);
  }
  printf("%d\n", sol);
  return 0;
}
