#include <bits/stdc++.h>
using namespace std;
int low, up, x, n;
int vec[16];
int recurse(int i, int a, int b, int s, int cnt) {
  if (i == n) {
    if (cnt >= 2 && low <= s && s <= up && a - b >= x) {
      return 1;
    }
    return 0;
  }
  return recurse(i + 1, max(a, vec[i]), min(b, vec[i]), s + vec[i], cnt + 1) +
         recurse(i + 1, a, b, s, cnt);
}
int main() {
  scanf("%d", &n);
  scanf("%d", &low);
  scanf("%d", &up);
  scanf("%d", &x);
  for (int i = 0; i <= n - 1; ++i) scanf("%d", &vec[i]);
  printf("%d\n", recurse(0, INT_MIN, INT_MAX, 0, 0));
  return 0;
}
