#include <bits/stdc++.h>
using namespace std;
bool A[1000005];
int T[1000005];
int main() {
  cin.sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    A[a] = true;
  }
  int ret = 0;
  for (int i = 1000002; i >= 1; --i) {
    if (!A[i]) continue;
    T[i] = 1;
    for (int j = i + i; j <= 1000002; j += i) {
      T[i] = max(T[i], 1 + T[j]);
    }
    ret = max(ret, T[i]);
  }
  cout << ret << '\n';
  return 0;
}
