#include using namespace std; #define int long long signed main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector x(n); for(int i = 0; i < n; i++){ cin >> x[i]; } sort(x.begin(),x.end()); map dp; for(int i : x){ dp[i] = max(dp[i],1LL); for(int j = i*2; j <= 1000000; j+=i){ dp[j] = max(dp[j],dp[i]+1); } } int ans = 0; for(int i : x){ ans = max(ans,dp[i]); } cout << ans << endl; return 0; }