#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int a[n];
  int dp[1000001] = {0}, h[1000001] = {0};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    h[a[i]]++;
  }
  sort(a, a + n);
  int fg = 0;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = a[i]; j <= 1000000; j += a[i]) {
      if (h[j]) {
        dp[a[i]] = max(dp[a[i]], dp[j] + 1);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= 1000000; i++) ans = max(ans, dp[i]);
  cout << ans << endl;
  return 0;
}
