#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x, arr[20];
  scanf("%d%d%d%d", &n, &l, &r, &x);
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  int res = 0;
  for (int i = 1; i < (1 << n); i++)
    if (__builtin_popcount(i) >= 2) {
      int sum = 0, mn = 10000000, mx = 0;
      for (int j = 0; j < n; j++)
        if ((1 << j) & i)
          mn = min(mn, arr[j]), mx = max(mx, arr[j]), sum += arr[j];
      if (sum >= l && sum <= r && mx - mn >= x) res++;
    }
  printf("%d", res);
}
