#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000003;
int a[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int ans = 0;
  int N = 1000000;
  while (n--) {
    int x;
    cin >> x;
    a[x]++;
    ans = max(ans, a[x]);
    for (int i = x * 2; i <= N; i += x) a[i] = max(a[i], a[x]);
  }
  cout << ans << "\n";
  return 0;
}
