#pragma GCC optimize("Ofast") #include using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull)rng() % B; } inline double time() { return static_cast(chrono::duration_cast(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9; } int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,l,r; cin >> n >> l >> r; int zero = 0; vector a; for (int i = 0; i < n; ++i) { int aa; cin >> aa; if (aa == 0) zero += 1; else a.push_back(aa); } if (l > 0 or 0 > r) zero = 0; n = a.size(); map,int> dp; dp[{-1e9, 1e9}] = 0; auto find_r = [&](int x, int l, int r) -> pair { int ll = l/x, rr = r/x; if (ll > rr) swap(ll, rr); pair res; for (int i = -2; i <= 2; ++i) { if (l <= (rr+i)*x and (rr+i)*x <= r) res.second = rr+i; if (l <= (ll-i)*x and (ll-i)*x <= r) res.first = ll-i; } return res; }; int res = 0; for (int i = 0; i < n; ++i) { map,int> ndp = dp; auto ku = find_r(a[i], l, r); for (auto &p : dp) { // cout << i << " " << p.first.first << " " << p.first.second << " " << p.second << endl; if (p.first.first <= a[i] and a[i] <= p.first.second) { int nl = max(p.first.first, ku.first); int nr = min(p.first.second, ku.second); res = max(res, p.second+1); if (nl <= nr) { ndp[{nl,nr}] = max(ndp[{nl,nr}], p.second+1); } } } swap(dp, ndp); } res += zero; cout << max(res, 1) << endl; }