#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
int main() {
  string second;
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  vector<int> c;
  for (int i = 0; i < n; i++) {
    int j;
    cin >> j;
    c.push_back(j);
  }
  int count = 0;
  int counter = 1;
  int mask = 1;
  int perms = pow((double)2, (double)c.size());
  while (counter < perms) {
    long long sum = 0;
    int min = INT_MAX;
    int max = -1;
    for (int h = 0; h < 32; h++) {
      int g = mask << h;
      if (counter & g) {
        sum += c[h];
        if (c[h] < min) {
          min = c[h];
        }
        if (c[h] > max) {
          max = c[h];
        }
      }
    }
    if (sum >= l && sum <= r && (max - min >= x)) {
      count++;
    }
    counter++;
  }
  cout << count;
  return 0;
}
