#include <bits/stdc++.h>
int ans = 0, n, l, r, x;
void solve(int i, int *mem, int *arr) {
  if (i == n) {
    int sum = 0, min = 10000000, max = 0, count = 0;
    for (int j = 0; j < n; j++) {
      if (mem[j] == 1) {
        sum += arr[j];
        if (arr[j] > max) max = arr[j];
        if (arr[j] < min) min = arr[j];
        count++;
      }
    }
    if (sum >= l && sum <= r && max - min >= x && count >= 2) ans++;
    return;
  }
  mem[i] = 0;
  solve(i + 1, mem, arr);
  mem[i] = 1;
  solve(i + 1, mem, arr);
}
int main() {
  scanf("%d %d %d %d", &n, &l, &r, &x);
  int *arr = (int *)malloc(15 * sizeof(int));
  int *mem = (int *)malloc(n * sizeof(int));
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }
  for (int i = 0; i < n; i++) mem[i] = 0;
  solve(0, mem, arr);
  printf("%d\n", ans);
  return 0;
}
