#include <bits/stdc++.h>
using namespace std;
void conan() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long a[1000005], b[1000005];
long long cnt = 0;
void merg(int s, int mid, int e) {
  int p = s, q = mid + 1, idx = s;
  while (p <= mid && q <= e) {
    if (a[p] <= a[q])
      b[idx++] = a[p++];
    else {
      cnt += q - idx;
      b[idx++] = a[q++];
    }
  }
  while (p <= mid) b[idx++] = a[p++];
  while (q <= e) b[idx++] = a[q++];
  for (int i = s; i <= e; i++) a[i] = b[i];
}
void mergSort(int s, int e) {
  if (s >= e) return;
  int mid = (s + e) / 2;
  mergSort(s, mid);
  mergSort(mid + 1, e);
  merg(s, mid, e);
}
void printNumber(int n, int len) {
  if (!len) return;
  printNumber(n >> 1, len - 1);
  cout << (n & 1);
}
void printAllSubsets(int len) {
  for (int i = 0; i < (1 << len); ++i) printNumber(i, len);
}
void printPowerSet(int *vector, int set_size) {
  unsigned int pow_set_size = pow(2, set_size);
  int counter, j;
  for (counter = 0; counter < pow_set_size; counter++) {
    for (j = 0; j < set_size; j++) {
      if (counter & (1 << j)) cout << vector[j];
    }
    cout << '\n';
  }
}
long long setbit(long long num, int idx, int val = 1) {
  return (val) ? (num | (1 << idx)) : (num & ~(1 << idx));
}
long long getbit(long long num, int idx) { return ((num >> idx) & 1) == 1; }
int contbit(int num) {
  int ret = 0;
  while (num) {
    if (num % 2) ret++;
    num /= 2;
  }
  return ret;
}
int contbit0(int num) {
  int ret = 0;
  while (num) {
    if (num & 1) ret++;
    num >>= 1;
  }
  return ret;
}
int contbit01(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ret++;
  }
  return ret;
}
int countNumBits1(int mask) {
  int ret = 0;
  while (mask) {
    if (mask & 1) ret++;
    mask >>= 1;
  }
  return ret;
}
int countNumBits2(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
int main() {
  conan();
  long long n, l, r, x, cnt = 0;
  cin >> n >> l >> r >> x;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int t = 1; t < (1 << n); t++) {
    long long mx = INT_MIN, mn = INT_MAX, sum = 0;
    for (int i = 0; i < n; i++) {
      if (t & (1 << i)) {
        mx = max(mx, v[i]);
        mn = min(mn, v[i]);
        sum += v[i];
      }
    }
    if (sum >= l && sum <= r && (mx - mn >= x)) cnt++;
  }
  cout << cnt << '\n';
}
