#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 1e6 + 4;
constexpr int MAXQ = 5e5 + 5;
constexpr int MOD = 1e9 + 7;
constexpr long long INF = 9187201950435737471;
constexpr int LOG = 35;
int n, dp[MAXN];
bool mark[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    mx = max(x, mx);
    mark[x] = true;
  }
  for (int i = mx; i >= 1; i--) {
    if (mark[i]) {
      for (int j = i + i; j <= mx; j += i) {
        dp[i] = max(dp[i], dp[j]);
      }
      dp[i]++;
    }
  }
  cout << *max_element(dp + 1, dp + mx + 1);
  return 0;
}
