#include <bits/stdc++.h>
using namespace std;
const int N = 1e6, M = 320, K = 1001;
const int oo = 1e9 + 7;
int dp[N + 1], n, a[N + 1], ans;
int main() {
  ios::sync_with_stdio(false);
  ;
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (int i = 1; i <= (n); ++i) cin >> a[i];
  for (int i = n; i >= (1); --i) {
    for (int j = 1; j <= N / a[i]; ++j)
      dp[a[i]] = max(dp[a[i]], dp[a[i] * j] + 1);
    ans = max(ans, dp[a[i]]);
  }
  cout << ans;
}
