#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans(0);
  for (int k = 3; k < (1 << n); ++k) {
    int total_difficulty(0);
    int minDif = INT_MAX;
    int maxDif = INT_MIN;
    for (int i = 0; i < n; ++i) {
      if (k & (1 << i)) {
        total_difficulty += a[i];
        minDif = min(minDif, a[i]);
        maxDif = max(maxDif, a[i]);
      }
    }
    if (total_difficulty >= l && total_difficulty <= r &&
        abs(minDif - maxDif) >= x)
      ++ans;
  }
  cout << ans << endl;
  return 0;
}
