#include <bits/stdc++.h>
using namespace std;
int n, l, r, x, res = 0;
vector<int> subset;
void search(int k, const vector<int>& v) {
  if (k == n) {
    long long count = accumulate(subset.begin(), subset.end(), 0);
    if (count >= l && count <= r && (subset.back() - subset.front()) >= x)
      ++res;
  } else {
    subset.push_back(v[k]);
    search(k + 1, v);
    subset.pop_back();
    search(k + 1, v);
  }
}
int main() {
  cin >> n >> l >> r >> x;
  vector<int> c(n);
  for (int i = 0; i < n; ++i) cin >> c[i];
  sort(c.begin(), c.end());
  search(0, c);
  cout << res;
}
