#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int A[n];
  long long int dp[1000010];
  memset(dp, 0, sizeof(dp));
  for (long long int i = 0; i < n; i += 1) {
    cin >> A[i];
    dp[A[i]] = 1;
  }
  sort(A, A + n);
  for (long long int i = 1; i < 1000010; i += 1) {
    if (dp[i] != 0) {
      for (long long int j = 2 * i; j < 1000010; j += i) {
        if (dp[j] != 0) {
          dp[j] = max(dp[j], dp[i] + 1);
        }
      }
    }
  }
  long long int ans = std::numeric_limits<long long int>::min();
  for (long long int i = 1; i < 1000010; i += 1) {
    ans = max(ans, dp[i]);
  }
  cout << ans;
  return 0;
}
