#include <bits/stdc++.h>
using namespace std;
class Solution {
 public:
  int solve();
};
int Solution::solve() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  if (n == 1) {
    return 0;
  }
  vector<int> t(n);
  for (int i = 0; i < n; ++i) {
    cin >> t[i];
  }
  int counter = 0;
  int maxi = 1 << n;
  for (int rr = 3; rr < maxi; ++rr) {
    int k = rr;
    int el = n - 1;
    vector<int> vect;
    int sum = 0;
    while (k) {
      if (k & 1) {
        vect.push_back(t[el]);
        sum += t[el];
      }
      k >>= 1;
      el--;
    }
    int maxim = *(max_element(vect.begin(), vect.end()));
    int minim = *(min_element(vect.begin(), vect.end()));
    if (vect.size() >= 2 && sum >= l && sum <= r && (maxim - minim) >= x) {
      counter++;
    }
  }
  return counter;
}
int main() {
  Solution s;
  cout << s.solve();
  return 0;
}
