#include <bits/stdc++.h>
using namespace std;
void fast_io() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void solve() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  int c[n];
  for (int i = 0; i < n; i++) cin >> c[i];
  int ways = 0;
  for (int i = 0; i < (1 << n); i++) {
    int sum = 0, mx = INT_MIN, mn = INT_MAX;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        sum += c[j];
        mx = max(mx, c[j]);
        mn = min(mn, c[j]);
      }
    }
    if (sum >= l && sum <= r && mx - mn >= x) {
      ways++;
    }
  }
  cout << ways << endl;
}
int main() {
  fast_io();
  solve();
  return 0;
}
