#include <bits/stdc++.h>
using namespace std;
int n, a[1000005], ans[1000005], res = 1;
int main(int argc, char **argv) {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", a + i), ans[a[i]] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 2 * a[i];; j += a[i]) {
      if (j > a[n - 1]) break;
      ans[j] = max(ans[j], ans[a[i]] + 1);
    }
  }
  for (int i = 0; i < n; ++i) res = max(res, ans[a[i]]);
  cout << res << endl;
  return 0;
}
