#include <bits/stdc++.h>
using namespace std;
bitset<20> a;
vector<int> w;
int sol = 0;
void verific(int &l, int &r, int &x) {
  int sum = 0, i, minim = INT_MAX, maxim = INT_MIN;
  for (i = 0; i < w.size(); ++i) {
    if (a[i]) {
      sum += w[i];
      minim = min(minim, w[i]);
      maxim = max(maxim, w[i]);
    }
  }
  if (sum >= l and sum <= r and maxim - minim >= x) ++sol;
}
int main() {
  int n, i, val, l, r, x;
  cin >> n >> l >> r >> x;
  for (i = 1; i <= n; ++i) {
    cin >> val;
    w.push_back(val);
  }
  for (i = 1; i <= 1 << n; ++i) {
    a = i;
    if (i & (i - 1) == 0) continue;
    verific(l, r, x);
  }
  cout << sol;
  return 0;
}
