#include <bits/stdc++.h>
using namespace std;
int n, a[2000005], ans[2000005], anss, num[2000005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
  for (int i = 1; i <= n; i++) {
    if (ans[num[i]] > anss) anss = ans[num[i]];
    for (int j = 2; j * num[i] <= num[n]; j++)
      ans[j * num[i]] = max(ans[j * num[i]], 1 + ans[num[i]]);
  }
  cout << anss + 1 << endl;
}
