#include <bits/stdc++.h>
using namespace std;
int n, l, r, x;
int c[16];
int choose[16];
int ans = 0;
bool check(int total) {
  int i, sum = 0, mini = 2147483647, maxi = 0;
  for (i = 0; i < total; i++) {
    sum += choose[i];
    if (choose[i] > maxi) maxi = choose[i];
    if (choose[i] < mini) mini = choose[i];
  }
  return (l <= sum && sum <= r && maxi - mini >= x);
}
void pick(int total, int first, int level) {
  int i;
  if (total == level) {
    if (check(total)) ans++;
    return;
  }
  for (i = first; i <= n - total + level; i++) {
    choose[level] = c[i];
    pick(total, i + 1, level + 1);
  }
}
int main() {
  int i;
  scanf("%d%d%d%d", &n, &l, &r, &x);
  for (i = 0; i < n; i++) scanf("%d", c + i);
  for (i = 2; i <= n; i++) pick(i, 0, 0);
  printf("%d\n", ans);
  return 0;
}
