#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, r, l, x;
  cin >> n >> l >> r >> x;
  vector<bool> mask;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < pow(2, n); i++) {
    mask.clear();
    int e = i;
    while (e > 0) {
      mask.push_back(e % 2);
      e = e / 2;
    }
    for (int i = mask.size(); i < n; i++) {
      mask.push_back(0);
    }
    reverse(mask.begin(), mask.end());
    long long sum = 0;
    long long mx = 0;
    long long min = 10000000;
    for (int i = 0; i < n; i++) {
      if (mask[i]) {
        sum += a[i];
        if (a[i] > mx) mx = a[i];
        if (a[i] < min) min = a[i];
      }
    }
    if (sum >= l && sum <= r && mx - min >= x) {
      ans++;
    }
  }
  cout << ans;
}
