#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int l;
  int r;
  int x;
  int result = 0;
  vector<int> tasks;
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) {
    int digit;
    cin >> digit;
    tasks.push_back(digit);
  }
  for (int i = 1; i <= pow(2, n) - 1; i++) {
    int *arr = new int[n];
    for (int j = 0; j < n; j++) {
      arr[j] = (int)((i >> j) & 1);
    }
    vector<int> prob;
    for (int j = 0; j < n; j++) {
      if (arr[j] == 1) {
        prob.push_back(tasks[j]);
      }
    }
    int min = prob[0];
    int max = prob[0];
    int sum = 0;
    if (prob.size() > 1)
      for (int j = 0; j < prob.size(); j++) {
        if (prob[j] > max) max = prob[j];
        if (min > prob[j]) min = prob[j];
        sum += prob[j];
      }
    if (max - min >= x && sum >= l && sum <= r) result = result + 1;
  }
  cout << result;
}
