#include <bits/stdc++.h>
using namespace std;
long long df[16];
int main() {
  long long n, l, r, x;
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> df[i];
  long long cmb = pow(2, n), use, cnt = 0;
  for (int i = 3; i < cmb; i++) {
    long long mask = i, sz = 0, ld = LONG_LONG_MAX, md = LONG_LONG_MIN, ttl = 0,
              ss = 0;
    while (mask) {
      use = mask % 2;
      mask /= 2;
      if (use == 1) {
        ld = min(ld, df[sz]);
        md = max(md, df[sz]);
        ss++;
        ttl += df[sz];
      }
      sz++;
    }
    if (ss >= 2) {
      if (md - ld >= x && ttl >= l && ttl <= r) cnt++;
    }
  }
  cout << cnt;
}
