#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, y, l, r, counter = 0;
  cin >> n >> l >> r >> y;
  vector<long long> arr(n, 0);
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 1; i < pow(2, n); i++) {
    bool isOkay = true;
    vector<long long> temp;
    string x = "";
    long long temp1 = i;
    while (temp1) {
      long long t = temp1 % 2;
      temp1 /= 2;
      x = char(t + 48) + x;
    }
    long long pos = n - 1;
    for (long long j = x.length() - 1; j >= 0; j--) {
      if (x[j] == '1') {
        temp.push_back(arr[pos]);
      }
      --pos;
    }
    sort(temp.begin(), temp.end());
    long long sum = 0;
    if (temp.size() > 1) {
      if (temp[temp.size() - 1] - temp[0] >= y) {
        for (long long k = 0; k < temp.size(); k++) {
          sum += temp[k];
        }
      } else {
        isOkay = false;
      }
      if (sum < l || sum > r) {
        isOkay = false;
      }
      if (isOkay == true) {
        ++counter;
      }
    }
  }
  cout << counter;
  return 0;
}
