#include <bits/stdc++.h>
using namespace std;
long long dp[1000005];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    dp[x] = 1;
  }
  long long ans = 1;
  for (long long i = 1000005 - 1; i >= 1; i--) {
    if (dp[i] != 0) {
      for (long long j = 2 * i; j < 1000005; j += i) {
        dp[i] = max(dp[i], 1 + dp[j]);
        ans = max(ans, dp[i]);
      }
    }
  }
  cout << ans;
  return 0;
}
