#include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) void chmax(ll &a,ll b){ if(a>n>>l>>r; vector a(n); rep(i,n) cin>>a.at(i); sort(a.begin(),a.end()); auto isok=[&](ll x){ return l<=x&&x<=r; }; vector> dp(n,vector(n,-1)); vector> vmx(n,vector(n+1,-1)); rep(chs,n){ dp.at(chs).at(chs)=1; vmx.at(chs).at(chs+1)=1; rep(i,chs){ if(isok(a.at(i)*a.at(chs))){ ll up=chs; ll dw=i; while(up-dw>1){ ll md=(up+dw)/2; if(isok(a.at(md)*a.at(chs))) dw=md; else up=md; } ll g=vmx.at(i).at(up); chmax(dp.at(i).at(chs),g+1); chmax(vmx.at(i).at(chs+1),max(vmx.at(i).at(chs),g+1)); } } } ll ans=0; rep(i,n) rep(j,n){ chmax(ans,dp.at(i).at(j)); } cout<