#include <bits/stdc++.h>
using namespace std;
bool valid(int l, int r, int x, int easy, int hard, int dif, int subset) {
  if (subset) {
    if (hard - easy >= x) {
      if (l <= dif && dif <= r) return 1;
    }
  }
  return 0;
}
int main() {
  int n, l, r, x, count = 0, dif_total = 0, subset = -1;
  scanf("%d %d %d %d", &n, &l, &r, &x);
  int c[n], easy = 1e6, hard = 1;
  for (int i = 0; i < n; ++i) scanf("%d", &c[i]);
  for (int i = 3; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j) {
      if (i & (1 << j)) {
        dif_total += c[j];
        subset++;
        hard = max(hard, c[j]);
        easy = min(easy, c[j]);
      }
    }
    if (valid(l, r, x, easy, hard, dif_total, subset)) count++;
    easy = 1e6, hard = 1, dif_total = 0, subset = -1;
  }
  printf("%d\n", count);
  return 0;
}
