#include <bits/stdc++.h>
using namespace std;
int n, l, r, x;
vector<int> generate_bitmasks(int i, int len) {
  vector<int> res;
  while (i > 0) {
    int rem = i % 2;
    i /= 2;
    res.push_back(rem);
  }
  if (res.size() != len) {
    int delta = len - res.size();
    while (delta--) {
      res.push_back(0);
    }
  }
  reverse(res.begin(), res.end());
  return res;
}
bool exist(vector<int>& a, vector<int>& mask) {
  long long sum = 0;
  set<int> nos;
  for (int i = 0; i < n; i++) {
    int res = a[i] * mask[i];
    sum += res;
    if (res != 0) nos.insert(res);
  }
  int mn = *min_element(nos.begin(), nos.end());
  int mx = *max_element(nos.begin(), nos.end());
  return (sum <= r && sum >= l && mx - mn >= x);
}
int main() {
  cin >> n >> l >> r >> x;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    int y;
    cin >> y;
    a.push_back(y);
  }
  set<int> powers_of_2 = {4,   8,    16,   32,   64,   128,   256,
                          512, 1024, 2048, 4096, 8192, 16384, 32768};
  vector<vector<int>> masks;
  int val = pow(2, n) - 1;
  for (int i = 3; i <= val; i++) {
    if (powers_of_2.find(i) != powers_of_2.end()) {
      continue;
    } else {
      masks.push_back(generate_bitmasks(i, n));
    }
  }
  long long ans = 0;
  for (int i = 0; i < masks.size(); ++i) {
    if (exist(a, masks[i])) ans++;
  }
  cout << ans << endl;
}
