#include <bits/stdc++.h>
using namespace std;
template <class T>
string ToString(T t) {
  stringstream s;
  s << t;
  return s.str();
}
template <class T>
void ToOther(T& t, string a) {
  stringstream s(a);
  s >> t;
}
int main() {
  int n, l, r, x, R = 0;
  ;
  cin >> n >> l >> r >> x;
  int a[20];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int st = 0; st < (1 << n); st++) {
    vector<int> v;
    for (int i = 0; i < n; i++)
      if (st >> i & 1) v.push_back(a[i]);
    if (v.size() < 2) continue;
    sort((v).begin(), (v).end());
    int sum = 0, dif;
    for (int i = 0; i < v.size(); i++) sum += v[i];
    dif = v.back() - v[0];
    if (l <= sum && sum <= r && dif >= x) R++;
  }
  cout << R << endl;
}
