#include <bits/stdc++.h>
using namespace std;
long po(int n) {
  long x = 1;
  while (n--) x = x * 2;
  return x;
}
int main() {
  int n;
  long long l, r, x;
  cin >> n >> l >> r >> x;
  long nn = po(n);
  long arr[n], i, j;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long count = 0, sum = 0, mini = INT_MAX, maxa = INT_MIN, fcnt = 0;
  for (i = 0; i < nn; i++) {
    count = 0, sum = 0, mini = INT_MAX, maxa = INT_MIN;
    for (j = 0; j < n; j++) {
      if (i & 1 << j) {
        count++;
        sum = sum + arr[j];
        if (arr[j] < mini) mini = arr[j];
        if (arr[j] > maxa) maxa = arr[j];
      }
    }
    if (l <= sum && sum <= r && count >= 2 && maxa - mini >= x) fcnt++;
  }
  cout << fcnt;
  return 0;
}
