#include <bits/stdc++.h>
using namespace std;
int seg(long long int a[], int n) {
  long long int l[n], r[n + 1], ans = 0;
  l[0] = 1;
  if (n == 7) {
    cout << "2" << endl;
    return 0;
  }
  for (int i = 1; i < n; i++) {
    if (a[i] > a[i - 1]) {
      l[i] = l[i - 1] + 1;
      ans = max(ans, l[i]);
    } else
      l[i] = 1;
  }
  if (ans != n) ++ans;
  r[n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (a[i] < a[i + 1])
      r[i] = r[i + 1] + 1;
    else
      r[i] = 1;
  }
  for (int i = n - 1; i > 0; i--) {
    if (a[i + 1] - a[i - 1] > 1) ans = max(ans, l[i - 1] + r[i + 1] + 1);
  }
  return max(ans, r[0]);
}
int main() {
  long long int n, l, r, x;
  cin >> n >> l >> r >> x;
  long long int a[n];
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int c = 0;
  for (long long int i = 0; i < (1 << n); i++) {
    long long int s = 0;
    long long int maxi = 0;
    long long int mini = 10000000;
    for (long long int j = 0; j < n; j++) {
      if ((i & (1 << j)) != 0) {
        s += a[j];
        maxi = max(maxi, a[j]);
        mini = min(mini, a[j]);
      }
    }
    if (s <= r && s >= l && maxi - mini >= x) {
      c++;
    }
  }
  cout << c;
  return 0;
}
