#include <bits/stdc++.h>
using namespace std;
int sieve(int n);
unsigned long long pow(long long base, long long power);
long long gcd(long long a, long long b) { return a % b ? gcd(b, a % b) : b; }
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
void quicken() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void file() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int n, sz, mini, maxi, diff, tot, way, x;
long long l, r;
int main() {
  quicken();
  cin >> n;
  cin >> l >> r >> x;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sz = pow(2, n), way = 0;
  for (int i = 0; i < sz; i++) {
    bitset<15> bt(i);
    if ((int)bt.count() >= 2) {
      tot = maxi = 0, mini = INT_MAX;
      for (int j = 0; j < n; j++)
        if (bt[j]) {
          tot += arr[j];
          maxi = max(maxi, arr[j]);
          mini = min(mini, arr[j]);
        }
      if (maxi - mini >= x && tot >= l && tot <= r) way++;
    }
  }
  cout << way;
  return 0;
}
unsigned long long pow(long long base, long long power) {
  if (power == 0) return 1;
  if (power == 1) return base;
  unsigned long long ans = pow(base, power / 2);
  ans *= ans;
  if (power & 1) return ans * base;
  return ans;
}
int sieve(int n) {
  int c = 0;
  vector<bool> isPrime(n + 1, true);
  isPrime[0] = isPrime[1] = 0;
  for (long long i = 2; i * i <= n; i++)
    if (isPrime[i])
      for (long long j = i * 2; j <= n; j += i) isPrime[j] = 0;
  for (int i = 0; i < n + 1; i++)
    if (isPrime[i]) c++;
  return c;
}
