#include <bits/stdc++.h>
using namespace std;
const int MN = 1000111;
int n, a[MN], f[MN];
int main() {
  ios ::sync_with_stdio(false);
  while (cin >> n) {
    for (int i = (1), _b = (n); i <= _b; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    int res = 0;
    for (int i = (1), _b = (n); i <= _b; i++) {
      int u = a[i];
      f[u] = max(f[u], 1);
      res = max(res, f[u]);
      for (int v = u + u; v < MN; v += u) {
        f[v] = max(f[v], f[u] + 1);
      }
    }
    cout << res << endl;
  }
}
