#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  int *x = (int *)malloc(1000002 * sizeof(int));
  int *y = (int *)malloc(1000002 * sizeof(int));
  int *dp = (int *)malloc(2000002 * sizeof(int));
  memset(dp, 0, 2000002 * sizeof(int));
  memset(x, 0, 1000002 * sizeof(int));
  for (int i = 0; i < n; i++) {
    cin >> y[i];
    x[y[i]]++;
  }
  int mx = y[n - 1];
  for (int i = 0; i < n; i++) {
    for (int k = 2 * y[i]; k <= 2 * mx; k += y[i]) {
      dp[k] = max(dp[k], x[y[i]] + dp[y[i]]);
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, dp[y[i]]);
  cout << ans + 1;
  return 0;
}
