#include <bits/stdc++.h>
using namespace std;
int ar[50];
int n, l, r, x, ans = 0, p = 0;
vector<int> vec;
void besaz(string s) {
  if (s.length() == n) {
    p++;
    vec.clear();
    for (int i = 0; i < n; i++)
      if (s[i] == '1') vec.push_back(ar[i]);
    sort(vec.begin(), vec.end());
    unsigned long long sum = 0;
    for (int i = 0; i < (int)vec.size(); i++) {
      sum += vec[i];
    }
    if (vec.size() >= 2 && sum <= r && sum >= l &&
        vec[vec.size() - 1] - vec[0] >= x)
      ans++;
    return;
  } else {
    besaz(s + '0');
    besaz(s + '1');
  }
}
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> ar[i];
  besaz("");
  cout << ans << endl;
  return 0;
}
