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