#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x;
  scanf("%d%d%d%d", &n, &l, &r, &x);
  int arr[n];
  int ans = 0;
  for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
  for (int m = 0; m < (1 << n); m++) {
    int mn = 1000000, mx = 0, cnt = 0, sum = 0;
    for (int i = 0; i < n; i++) {
      if ((m & (1 << i)) != 0) {
        cnt++;
        sum += arr[i];
        mn = min(mn, arr[i]);
        mx = max(mx, arr[i]);
      }
    }
    if ((mx - mn) >= x && sum >= l && sum <= r && cnt >= 2) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
