#include <bits/stdc++.h>
using namespace std;
void Generate(vector<int>, int, int&, vector<int>&, int, int, int);
int main() {
  int elementCount;
  int minComplexity, maxComplexity;
  int difference;
  cin >> elementCount >> minComplexity >> maxComplexity >> difference;
  vector<int> complexity(elementCount);
  for (int i = 0; i < elementCount; i++) {
    cin >> complexity[i];
  }
  int wayCount = 0;
  vector<int> sequence(elementCount);
  int t = 0;
  Generate(sequence, t, wayCount, complexity, minComplexity, maxComplexity,
           difference);
  cout << wayCount << endl;
  return 0;
}
void Generate(vector<int> sequence, int t, int& wayCount,
              vector<int>& complexity, int minComplexity, int maxComplexity,
              int difference) {
  if (t == sequence.size()) {
    int nonZeroCount = 0;
    for (int i = 0; i < sequence.size(); i++) {
      if (sequence[i] != 0) {
        nonZeroCount++;
      }
    }
    if (nonZeroCount < 2) {
      return;
    }
    int max = 0, min = 1e7, sum = 0;
    for (int i = 0; i < sequence.size(); i++) {
      if (sequence[i] != 0) {
        sum += complexity[i];
        if (max < complexity[i]) {
          max = complexity[i];
        }
        if (min > complexity[i]) {
          min = complexity[i];
        }
      }
    }
    if ((max - min) >= difference && sum >= minComplexity &&
        sum <= maxComplexity) {
      wayCount++;
    }
  } else {
    sequence[t] = 0;
    Generate(sequence, t + 1, wayCount, complexity, minComplexity,
             maxComplexity, difference);
    sequence[t] = 1;
    Generate(sequence, t + 1, wayCount, complexity, minComplexity,
             maxComplexity, difference);
  }
}
