#include <bits/stdc++.h>
using namespace std;
int a[1100001];
bool x[1100001];
int dp[1100001];
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    x[a[i]] = true;
    dp[a[i]] = 1;
  }
  for (int i = 1; i <= 1000000; ++i) {
    if (x[i]) {
      for (int j = i + i; j <= 1000000; j += i)
        if (x[j]) dp[j] = max(dp[j], dp[i] + 1);
    }
  }
  int mx = 0;
  for (int i = 1; i <= 1000000; ++i) {
    mx = max(mx, dp[i]);
  }
  cout << mx;
  return 0;
}
