#include #define rep(i, a, n) for(int i = a; i < n; i++) #define repp(i, n) rep(i, 0, n) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define int long long using namespace std; typedef pair P; signed main(){ int n; cin >> n; vector x(n); rep(i, 0, n) cin >> x[i]; sort(all(x)); vector dp(1000001); int MAX = x[n - 1]; for(auto i:x){ dp[i] = 1; } for(auto i: x){ for(int j = 2 * i; j <= MAX; j += i){ if(dp[j] == 0) continue; dp[j] = max(dp[j], dp[i] + 1); } } cout << *max_element(all(dp)) << endl; }