#include #define rep(i, n) for (int i = 0; i < (n); ++i) using std::cin; using std::cout; using std::vector; inline void chmax(int& x, int y) { if (x < y) x = y; } int main() { int n; cin >> n; vector a(n); rep(i, n) cin >> a[i]; vector dp(n); rep(i, n) { dp[i] = 1; rep(j, i) { if (a[i] == a[j]) continue; if (a[i] % a[j] == 0) chmax(dp[i], dp[j] + 1); } } int ans = *max_element(dp.begin(), dp.end()); cout << ans << '\n'; return 0; }