#include <bits/stdc++.h>
using namespace std;
int a[22];
int main(void) {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  int i, n, l, r, x;
  int themin, themax, sum, j;
  int re = 0;
  cin >> n >> l >> r >> x;
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < 1 << n; i++) {
    sum = 0;
    themax = 0;
    themin = 1000000000;
    for (j = 0; j < n; j++) {
      if (i & 1 << j) {
        sum += a[j];
        themax = max(a[j], themax);
        themin = min(a[j], themin);
      }
    }
    if (sum <= r && sum >= l && themax - themin >= x) re++;
  }
  cout << re << endl;
  return 0;
}
