#include #define rep(i,n) for(int i=(0);i<(n);i++) using namespace std; typedef long long ll; template bool chmax(T &a, const T &b) { if (a bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector x(n); rep(i, n) cin >> x[i]; sort(x.begin(), x.end()); int max_x = 1010101; vector dp(max_x, 1); rep(i, n){ int y = x[i]; for(int j = 2 * y; j < max_x; j += y) chmax(dp[j], dp[y] + 1); } int ans = 0; rep(i, n) chmax(ans, dp[x[i]]); cout << ans << endl; }