#include using namespace std; #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif #define int long long signed main(){ int n; cin >> n; vector a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } sort(a.begin(),a.end()); vector v(1000001, 0); for(int i = 0; i < n; i++){ for(int j = a[i] * 2; j < 1000001; j+=a[i]){ v[j] = max(v[j], v[a[i]] + 1); } } cout << *max_element(v.begin(),v.end()) << endl; return 0; }