#include <bits/stdc++.h>
using namespace std;
int c[20], st[20];
int minim, maxim, dif, suma;
int n, minn, maxx, x, solutii;
bool Sol() {
  if (suma >= minn && suma <= maxx && dif >= x) return 1;
  return 0;
}
void Afisare(int k) {
  int i;
  for (i = 1; i < k; i++) cout << c[st[i]] << " ";
  cout << "\n";
}
void Back(int k) {
  int i, lmax, ldif, lmin;
  if (Sol() && k > 2) {
    solutii++;
  }
  for (int i = st[k - 1] + 1; i <= n; i++) {
    suma += c[i];
    if (c[i] > maxim) {
      lmax = maxim;
      maxim = c[i];
    } else
      lmax = maxim;
    if (c[i] < minim) {
      lmin = minim;
      minim = c[i];
    } else
      lmin = minim;
    ldif = dif;
    dif = maxim - minim;
    st[k] = i;
    Back(k + 1);
    suma -= c[i];
    maxim = lmax;
    minim = lmin;
    dif = ldif;
  }
}
int main() {
  ifstream fin("date");
  cin >> n >> minn >> maxx >> x;
  for (int i = 1; i <= n; i++) cin >> c[i];
  minim = 1000002;
  maxim = 0;
  suma = 0;
  dif = 0;
  solutii = 0;
  st[0] = 0;
  Back(1);
  cout << solutii << " ";
  return 0;
}
