#include <bits/stdc++.h>
using namespace std;
int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }
int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; }
const long long int MAXN = 1e6 + 10;
long long int n, ans = 1;
long long int a[MAXN], dp[MAXN];
void solve() {
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    cin >> a[i];
    dp[a[i]]++;
  }
  for (int i = (MAXN - 1); i >= (1); --i) {
    if (!dp[i]) continue;
    for (long long int j = 2 * i; j <= MAXN - 1; j += i) {
      dp[i] = max(dp[i], 1 + dp[j]);
      ans = max(ans, dp[i]);
    }
  }
  cout << ans << endl;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  for (int i = (1); i <= (t); ++i) {
    solve();
  }
}
