#include <bits/stdc++.h>
using namespace std;
long long n, l, r, x, y, ans;
long long D[20];
void bin(long a) {
  long long G[n], b, k, min, max;
  b = a;
  max = 0;
  min = 1000000;
  y = 0;
  k = 0;
  for (int i = n - 1; i >= 0; i = i - 1) {
    if (b >= pow(2, i)) {
      G[n - i - 1] = 1;
      b = b - pow(2, i);
      k = k + 1;
    } else {
      G[n - i - 1] = 0;
    }
  }
  if (k > 1) {
    for (int i = 0; i < n; i = i + 1) {
      if (G[i] == 1) {
        y = y + D[i];
        if (D[i] > max) {
          max = D[i];
        }
        if (D[i] < min) {
          min = D[i];
        }
      }
    }
    if (y >= l && y <= r && (max - min) >= x) {
      ans = ans + 1;
    }
  }
}
int main() {
  cin >> n >> l >> r >> x;
  ans = 0;
  for (int i = 0; i < n; i = i + 1) {
    cin >> D[i];
  }
  for (long long i = 1; i < pow(2, n); i = i + 1) {
    bin(i);
  }
  cout << ans;
}
