#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, 1); 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); } } int ans = 0; for(int i = 0; i < n; i++){ ans = max(ans, v[a[i]]); } cout << ans << endl; return 0; }