#include #include #include int main() { int n; std::cin >> n; std::vector a(n), dp(n); for (int i = 0; i < n; ++i) { std::cin >> a[i]; int t = 0; for (int j = 0; j < i; ++j) { if (a[i] > a[j] && a[i] % a[j] == 0) { t = std::max(t, dp[j]); } } dp[i] = t + 1; } std::cout << *std::max_element(dp.cbegin(), dp.cend()); }