#include typedef long long ll; using namespace std; int N; vector x; vector dp(1000001, 0); int main(void){ cin >> N; for(int i = 0; i < N; ++i){ int n; cin >> n; x.push_back(n); dp[x[i]] = 1; } sort(x.begin(), x.end()); for(auto i : x){ for(int j = i + i; j <= x[N - 1]; j += i){ if(dp[j]) dp[j] = max(dp[j], dp[i] + 1); } } int ans = 0; for(int i = 0; i <= x[N - 1]; ++i) ans = max(ans, dp[i]); cout << ans << endl; return 0; }