#pragma GCC optimize("O2") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define int ll #define INT128_MAX (__int128)(((unsigned __int128) 1 << ((sizeof(__int128) * __CHAR_BIT__) - 1)) - 1) #define INT128_MIN (-INT128_MAX - 1) #define clock chrono::steady_clock::now().time_since_epoch().count() #ifdef DEBUG #define dbg(x) cout << (#x) << " = " << x << '\n' #else #define dbg(x) #endif namespace R = std::ranges; namespace V = std::views; using namespace std; using ll = long long; using ull = unsigned long long; using ldb = long double; using pii = pair; using pll = pair; //#define double ldb template ostream& operator<<(ostream& os, const pair pr) { return os << pr.first << ' ' << pr.second; } template ostream& operator<<(ostream& os, const array &arr) { for(const T &X : arr) os << X << ' '; return os; } template ostream& operator<<(ostream& os, const vector &vec) { for(const T &X : vec) os << X << ' '; return os; } template ostream& operator<<(ostream& os, const set &s) { for(const T &x : s) os << x << ' '; return os; } signed main() { ios::sync_with_stdio(false), cin.tie(NULL); int n, l, r; cin >> n >> l >> r; vector a(n); for(int &x : a) cin >> x; R::sort(a); vector nxt(n); iota(nxt.begin(), nxt.end(), 0); for(int i = 0; i < n; i++) while(nxt[i] < n and a[i] * a[nxt[i]] > r) nxt[i]++; vector pre(n); iota(pre.begin(), pre.end(), 0); for(int i = 0; i < n; i++) while(pre[i] >= 0 and a[i] * a[pre[i]] > r) pre[i]--; vector nxt2(n); iota(nxt2.begin(), nxt2.end(), 0); for(int i = 0; i < n; i++) while(nxt2[i] < n and a[i] * a[nxt2[i]] < l) nxt2[i]++; vector pre2(n); iota(pre2.begin(), pre2.end(), 0); for(int i = 0; i < n; i++) while(pre2[i] >= 0 and a[i] * a[pre2[i]] < l) pre2[i]--; int ans = 1; for(int i = 0; i < n; i++) { for(int j = i + 1; j < n; j++) { if (a[i] * a[j] < 0) { if (nxt[i] <= j and pre[j] >= i and a[i] * a[j] >= l) ans = max(ans, 2 + max(min(pre[j], j - 1) - max(nxt[i], i + 1) + 1, 0ll)); } else if (a[i] < 0) { if (nxt[i] <= j and pre2[j] >= i) ans = max(ans, 2 + max(min(pre2[j], j - 1) - max(nxt[i], i + 1) + 1, 0ll)); } else { if (nxt2[i] <= j and pre[j] >= i) ans = max(ans, 2 + max(min(pre[j], j - 1) - max(nxt2[i], i + 1) + 1, 0ll)); } } } cout << ans << '\n'; return 0; }