#include <bits/stdc++.h>
using namespace std;
int x, l, r;
int cnt = 0;
bool check(vector<int> arr, int x, int l, int r) {
  sort(arr.begin(), arr.end());
  if (arr[arr.size() - 1] - arr[0] < x) {
    return false;
  }
  int s = 0;
  for (auto k : arr) {
    s += k;
  }
  if (s < l || s > r) return false;
  return true;
}
void gen_set(vector<int> arr, int i, int c, vector<int> temp) {
  if (c >= 2) {
    if (check(temp, x, l, r)) {
      cnt++;
    }
  }
  for (int p = i; p < arr.size(); p++) {
    temp.push_back(arr[p]);
    gen_set(arr, p + 1, c + 1, temp);
    temp.pop_back();
  }
}
int main() {
  int n;
  cin >> n >> l >> r >> x;
  int b = n;
  vector<int> a;
  int q;
  while (b--) {
    cin >> q;
    a.push_back(q);
  }
  vector<int> mm;
  gen_set(a, 0, 0, mm);
  cout << cnt << endl;
  return 0;
}
