#include #include #include #include #include // #910608 ベース 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); std::vector p(n, n), q(n, -1); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { if (l < a[i] * a[j] && a[i] * a[j] <= r) { if (p[i] == n) p[i] = j; q[i] = j; } } } int ans = 1; for (int i = 0; i < n; ++i) { for (int j = std::max(p[i], i + 1); j <= q[i]; ++j) { const int inside = std::min({q[i], q[j], j - 1}) - std::max({p[i], p[j], i + 1}) + 1; ans = std::max(ans, 2 + std::max(inside, 0)); } } std::cout << ans << '\n'; return 0; }