#include <bits/stdc++.h>
using namespace std;
double const pi = 3.14159265358979;
int const MAXN = 2000000;
long long const MOD = 1000000007;
long long const INF = 1000000000000000000ll;
int a[2000000], d[2000000];
bool is[2000000];
int main() {
  int n, res = 0;
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); i++) {
    scanf("%d", &a[i]);
    is[a[i]] = 1;
  }
  for (int i = (int)1; i <= (int)(1000000); i++) {
    d[i] = 1;
  }
  for (int i = 0; i < (int)(n); i++) {
    int k = 2;
    while (a[i] * k <= 1000000) {
      d[a[i] * k] = max(d[a[i] * k], d[a[i]] + 1);
      k++;
    }
    res = max(res, d[a[i]]);
  }
  printf("%d\n", res);
  return 0;
}
