#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000000 + 10;
int vis[maxn], a[maxn], vis2[maxn];
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; ++i) {
      scanf("%d", &a[i]);
      vis[a[i]] = 1;
    }
    int ma = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = a[i] << 1; j <= a[n - 1]; j += a[i]) {
        if (vis[a[i]] == vis[j]) vis[j]++;
      }
      ma = std::max(ma, vis[a[i]]);
    }
    printf("%d\n", ma);
  }
  return 0;
}
