#include <bits/stdc++.h>   using namespace std;   const long long mod = 1000000007;   const int MAXN = 1000005;   int dp[MAXN];   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     int n;     cin >> n;     int x;     int maxn = 0;     for (int i = 0; i < n; i++) {       cin >> x;       dp[x]++;       maxn = max(maxn, dp[x]);       for (int j = x * 2; j < MAXN; j += x) {         dp[j] = max(dp[j], dp[x]);       }     }     cout << maxn << endl;     return 0;   }   