#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int isPresent[N + 5];
int dp[N + 5];
int n, res;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    isPresent[a[i]] = 1;
    dp[a[i]] = 1;
  }
  res = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 2 * a[i]; j <= N; j += a[i]) {
      if (isPresent[j]) {
        dp[j] = max(dp[j], 1 + dp[a[i]]);
        res = max(res, dp[j]);
      }
    }
  }
  cout << res << endl;
  return 0;
}
