#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int dp[1000005], ans, x;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  for (int i = 1000002; i >= 1; i--) {
    int temp = i;
    while (temp < 1000003) {
      if (a[i] && a[temp] == 1) {
        dp[i] = max(dp[i], dp[temp] + 1);
        ans = max(ans, dp[i]);
      }
      temp += i;
    }
  }
  cout << ans;
}
