#include <bits/stdc++.h>
using namespace std;
int dp[1000009];
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int maxi = -1;
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    maxi = max(t, maxi);
    dp[t]++;
  }
  for (int i = 1; i <= maxi; i++) {
    for (int j = 2 * i; j <= maxi; j += i) {
      if (dp[j] != 0) dp[j] = max(dp[j], dp[i] + 1);
    }
  }
  cout << *max_element(dp, dp + maxi + 1) << endl;
  return 0;
}
