#include <bits/stdc++.h>
using namespace std;
inline void _redirect_streams(const string input = "",
                              const string output = "") {
  if (not input.empty()) assert(freopen(input.c_str(), "r", stdin) != nullptr);
  if (not output.empty())
    assert(freopen(output.c_str(), "w", stdout) != nullptr);
}
inline void _speed_up_iostreams() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
inline void _prepare() { _speed_up_iostreams(); }
const int MAX_N = 1000 * 1000 + 1;
int dp[MAX_N];
int main() {
  _prepare();
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int a;
    scanf("%d", &a);
    int val = (dp[a] + 1);
    ans = max(ans, val);
    for (int j = a + a; j < MAX_N; j += a) {
      dp[j] = max(dp[j], val);
    }
  }
  printf("%d\n", ans);
  return 0;
}
