#include <bits/stdc++.h>
long long n, l, r, x, arr[100], cant = 0, may = 0, v1 = 10000000, v2, mark[20];
void recur(int pos, long long sum, int c) {
  if (pos == n) {
    if (c < 2) return;
    if (sum < l or sum > r) return;
    v1 = 10000000;
    v2 = 0;
    for (int i = 0; i < n; i++) {
      if (mark[i] != 0) {
        if (arr[i] < v1) v1 = arr[i];
        if (arr[i] > v2) v2 = arr[i];
      }
    }
    if (v2 - v1 < x) return;
    cant++;
    return;
  }
  recur(pos + 1, sum, c);
  mark[pos] = 1;
  recur(pos + 1, sum + arr[pos], c + 1);
  mark[pos] = 0;
  return;
}
int main() {
  scanf("%I64d%I64d%I64d%I64d", &n, &l, &r, &x);
  for (int i = 0; i < n; i++) scanf("%I64d", &arr[i]);
  recur(0, 0, 0);
  printf("%I64d", cant);
  return 0;
}
