#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x, p, count = 0;
  scanf("%d %d %d %d", &n, &l, &r, &x);
  vector<int> v1(n + 5), v2;
  for (int i = 0; i < n; i++) scanf("%d", &v1[i]);
  p = pow(2, n);
  for (int i = 0; i < p; i++) {
    for (int j = 0; j < n; j++) {
      int ret;
      ret = (i >> j) & 1;
      if (ret == 1) v2.push_back(v1[j]);
    }
    if (v2.size() >= 2) {
      int dif, sum = 0;
      sort(v2.begin(), v2.end());
      dif = v2[v2.size() - 1] - v2[0];
      for (int i = 0; i < v2.size(); i++) sum += v2[i];
      if ((sum >= l && sum <= r) && dif >= x) count++;
    }
    v2.clear();
  }
  printf("%d\n", count);
  return 0;
}
