#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x, mini, to_sum, diff, to_set = 0;
  cin >> n >> l >> r >> x;
  int arr[17];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int b = 0; b < (1 << n); b++) {
    vector<int> subset;
    mini = 0;
    for (int i = 0; i < n; i++) {
      if (b & (1 << i)) {
        subset.push_back(arr[i]);
        mini++;
      }
    }
    if (mini >= 2) {
      sort(subset.begin(), subset.end());
      to_sum = accumulate(subset.begin(), subset.end(), 0);
      int maxim = *max_element(subset.begin(), subset.end());
      int minim = *min_element(subset.begin(), subset.end());
      diff = maxim - minim;
      if (diff >= x && to_sum >= l && to_sum <= r) to_set++;
    }
  }
  cout << to_set << endl;
  return 0;
}
