#include <bits/stdc++.h>
using namespace std;
long long counter;
long long n, r, l, x;
vector<long long> a;
long long sum, rr;
bool cheake(long long mask) {
  long long nmax = -1;
  long long nmin = 10000000000;
  long long i = 0;
  rr = 0;
  sum = 0;
  while ((mask >> i) != 0) {
    if ((mask >> i) % 2 == 1) {
      rr++;
      sum = sum + a[i];
      nmax = max(a[i], nmax);
      nmin = min(a[i], nmin);
    }
    i++;
  }
  if ((rr >= 2) && (sum >= l) && (sum <= r) && (nmax - nmin) >= x)
    return true;
  else
    return false;
}
void solv(long long i, long long mask) {
  if (i == n) return;
  solv(i + 1, mask);
  long long nmask = mask | (1 << i);
  solv(i + 1, nmask);
  if (cheake(nmask)) counter++;
}
int main() {
  long long k;
  cin >> n >> l >> r >> x;
  for (long long i = 0; i < n; i++) {
    cin >> k;
    a.push_back(k);
  }
  solv(0, 0);
  cout << counter;
}
