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