#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int ind[1000005];
int ans[1000005];
int main() {
  ios::sync_with_stdio(0);
  for (int x = 0; x <= 1000000; x++) ind[x] = -1;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    ind[a[i]] = i;
  }
  int best = 1;
  for (int i = n - 1; i >= 0; i--) {
    int sz = 1;
    int x = 2 * a[i];
    while (x <= a[n - 1]) {
      if (ind[x] != -1) sz = max(sz, 1 + ans[ind[x]]);
      x += a[i];
    }
    ans[i] = sz;
    best = max(sz, best);
  }
  cout << best << endl;
  return 0;
}
