#include <bits/stdc++.h>
using namespace std;
int M[1000006], A[1000006], n, i, j, mx;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) scanf("%d", &A[i]);
  for (i = 1; i <= n; i++) {
    mx = max(mx, ++M[A[i]]);
    for (j = A[i]; j <= A[n]; j += A[i]) M[j] = max(M[j], M[A[i]]);
  }
  cout << mx;
  return 0;
}
