#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  int a[100];
  for (int i = 0; i < n; i++) {
    int g;
    cin >> g;
    a[i] = g;
  }
  int lim = pow(2, n);
  int ways = 0;
  for (int mask = 1; mask <= lim; mask++) {
    int ma = 0;
    int mi = (int)1e9;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        if (a[i] > ma) ma = a[i];
        if (a[i] < mi) mi = a[i];
        sum += a[i];
      }
    }
    if (sum >= l && sum <= r && (ma - mi) >= x) ways++;
  }
  cout << ways << endl;
}
