#include <bits/stdc++.h>
using namespace std;
int n, a[1000005], h[1000005], mx;
int main() {
  int i;
  cin >> n;
  for (i = 0; i < n; i++) scanf("%d", a + i);
  for (i = 0; i < n; i++) {
    int x = a[i];
    h[x]++;
    for (int j = x; j < 1000001; j += x) h[j] = max(h[x], h[j]);
  }
  for (i = 0; i < 1000001; i++) mx = max(h[i], mx);
  cout << mx;
}
