#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
const int L = 10;
const double eps = 1e-9;
const int BIG = 1e6;
int dp[N], a[N];
int main() {
  clock_t tm = clock();
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  int __t = 1;
  for (int _t = 1; _t <= __t; ++_t) {
    int n;
    cin >> n;
    for (int i = 0; i <= N - 1; ++i) dp[i] = 1;
    for (int i = 0; i <= n - 1; ++i) {
      cin >> a[i];
    }
    for (int i = 0; i <= n - 1; ++i) {
      for (int j = 2 * a[i]; j < N; j += a[i]) {
        dp[j] = max(dp[j], dp[a[i]] + 1);
      }
      for (int i = 0; i <= n - 1; ++i) {
      }
    }
    int maxi = 0;
    for (int i = 0; i <= n - 1; ++i) {
      maxi = max(maxi, dp[a[i]]);
    }
    cout << maxi << "\n";
  }
  tm = clock() - tm;
  cerr << (float)(tm) / CLOCKS_PER_SEC << "\n";
  return 0;
}
