#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,l,r,x; cin>>n>>l>>r>>x;
int ara[n+9], ans=0;
for(int i=1; i<=n; i++) cin>>ara[i];
for(int i=1; i<(1<<n); i++){
int mx=0, sum=0, mn=1e9+9;
for(int j=1; j<=n; j++){
if(i&(1<<(j-1))) {
sum+=ara[j];
mx=max(mx, ara[j]);
mn=min(mn, ara[j]);
}
}
if(mx-mn>=x and sum>=l and sum<=r) ans++;
}
cout<<ans<<endl;
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKQp7CglpbnQgbixsLHIseDsgY2luPj5uPj5sPj5yPj54OwoJaW50IGFyYVtuKzldLCBhbnM9MDsKCWZvcihpbnQgaT0xOyBpPD1uOyBpKyspIGNpbj4+YXJhW2ldOwoJCglmb3IoaW50IGk9MTsgaTwoMTw8bik7IGkrKyl7CgkJaW50IG14PTAsIHN1bT0wLCBtbj0xZTkrOTsKCQlmb3IoaW50IGo9MTsgajw9bjsgaisrKXsKCQkJaWYoaSYoMTw8KGotMSkpKSB7CgkJCQlzdW0rPWFyYVtqXTsKCQkJCW14PW1heChteCwgYXJhW2pdKTsKCQkJCW1uPW1pbihtbiwgYXJhW2pdKTsKCQkJfQoJCX0KCQlpZihteC1tbj49eCBhbmQgc3VtPj1sIGFuZCBzdW08PXIpIGFucysrOwoJfQoJY291dDw8YW5zPDxlbmRsOwoJcmV0dXJuIDA7Cn0=