#include <bits/stdc++.h>
using namespace std;
int dp[1000009] = {0};
int a[1000009] = {0};
int main() {
  int n, x, m = 0, ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    m = max(a[i], m);
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    dp[a[i]] = max(dp[a[i]], 1);
    ans = max(ans, dp[a[i]]);
    for (int j = 2; a[i] * j <= m; j++) {
      dp[a[i] * j] = max(dp[a[i] * j], dp[a[i]] + 1);
    }
  }
  printf("%d\n", ans);
  return 0;
}
