#include <bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
int n, arr[N], DP[N];
int ans;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    DP[arr[i]]++;
    for (int j = 2 * arr[i]; j <= arr[n - 1]; j += arr[i]) {
      DP[j] = max(DP[j], DP[arr[i]]);
    }
  }
  for (int i = 0; i < n; i++) ans = max(ans, DP[arr[i]]);
  printf("%d", ans);
  return 0;
}
