#include <bits/stdc++.h>
using namespace std;
int ans[1000005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, y, p, i, j = 0;
  cin >> n;
  int arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    ans[arr[i]] = 1;
  }
  for (i = n - 1; i >= 0; i--) {
    p = 2, y = 0;
    x = arr[i] * p;
    while (x <= arr[n - 1]) {
      y = max(y, ans[x]);
      p++;
      x = arr[i] * p;
    }
    ans[arr[i]] = 1 + y;
    j = max(j, ans[arr[i]]);
  }
  cout << j;
  return 0;
}
