#include <bits/stdc++.h>
using namespace std;
int a[20];
int myPow(int x) {
  int res = 1;
  while (x--) res *= 2;
  return res;
}
int main() {
  int n, l, r, x;
  scanf("%d%d%d%d", &n, &l, &r, &x);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  sort(a, a + n);
  int my = myPow(n);
  int ans = 0;
  for (int i = 0; i < my; ++i) {
    int t = i, ma = 0, mi = 1100000, cnt = 0, all = 0, now = 0;
    ;
    while (t) {
      if (t & 1) {
        all += a[now];
        ma = max(ma, a[now]);
        mi = min(mi, a[now]);
        cnt++;
      }
      now++;
      t >>= 1;
    }
    if (all >= l && all <= r && ma - mi >= x && cnt >= 2) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
