#include #include #include #include #include #include // #910615 ベース int main() { constexpr int kMaxN = 5000, kMinA = -1000000000, kMaxA = 1000000000; int n, l, r; std::cin >> n >> l >> r; assert(1 <= n && n <= kMaxN && kMinA <= l && l <= r && r <= kMaxA); std::vector a(n); for (int i = 0; i < n; ++i) { std::cin >> a[i]; assert(kMinA <= a[i] && a[i] <= kMaxA); } std::ranges::sort(a); int ans = 1; std::vector p(n, n), q(n, -1); for (int i = 0; i < n; ++i) { if (a[i] < 0) { for (int lb = -1; lb + 1 < p[i];) { const int cand_p = std::midpoint(lb, p[i]); (a[i] * a[cand_p] <= r ? p[i] : lb) = cand_p; } for (int ub = n; q[i] + 1 < ub;) { const int cand_q = std::midpoint(q[i], ub); (a[i] * a[cand_q] >= l ? q[i] : ub) = cand_q; } } else { for (int lb = -1; lb + 1 < p[i];) { const int cand_p = std::midpoint(lb, p[i]); (a[i] * a[cand_p] >= l ? p[i] : lb) = cand_p; } for (int ub = n; q[i] + 1 < ub;) { const int cand_q = std::midpoint(q[i], ub); (a[i] * a[cand_q] <= r ? q[i] : ub) = cand_q; } } if (q[i] < p[i]) { p[i] = n; q[i] = -1; } else if (p[i] != i || q[i] != i) { ans = 2; } } for (int i = 0; i + 1 < n; ++i) { if (p[i] <= i + 1) { int j = i + 1; for (int ub = q[i] + 1; j + 1 < ub;) { const int cand_j = std::midpoint(j, ub); (p[cand_j] <= i && cand_j - 1 <= q[cand_j] ? j : ub) = cand_j; } ans = std::max(ans, j - i + 1); } } std::cout << ans << '\n'; return 0; }