#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 1e5 + 1;
const long long M = 1e9 + 7;
const long long INF = 1e9;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long calculateNcR(long long n, long long r) {
  long long p = 1, k = 1;
  if (n - r < r) r = n - r;
  if (r != 0) {
    while (r) {
      p *= n;
      k *= r;
      long long m = gcd(p, k);
      p /= m;
      k /= m;
      n--;
      r--;
    }
  } else
    p = 1;
  return p;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
vector<long long> prime;
void prime_num(long long n) {
  vector<long long> v;
  long long i, j;
  for (i = 0; i <= n; i++) v.push_back(i);
  v[0] = -1;
  v[1] = -1;
  for (i = 0; i <= sqrt(n); i++) {
    if (v[i] == -1) {
      continue;
    }
    for (j = i + i; j <= n; j += i) {
      v[j] = -1;
    }
  }
  for (i = 2; i <= n; i++) {
    if (v[i] != -1) {
      prime.push_back(i);
    }
  }
}
unsigned long long power(unsigned long long x, long long y, long long p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
struct Four {
  long long a, b, c, d;
};
struct Triplet {
  long long x, y, z;
  Triplet() {}
  Triplet(long long x, long long y, long long z) : x(x), y(y), z(z) {}
  bool operator<(const Triplet &other) const { return z < other.z; }
};
vector<long long> printDivisors(long long n) {
  vector<long long> div;
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        div.push_back(i);
      else {
        div.push_back(i);
        div.push_back(n / i);
      }
    }
  }
  sort(div.begin(), div.end());
  return div;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i < n; i++)
    if (n % i == 0) return false;
  return true;
}
void solve() {
  long long n, l, r, x;
  cin >> n >> l >> r >> x;
  vector<long long> arr;
  for (long long i = 0; 0 < n ? i < n : i > n; 0 < n ? i += 1 : i -= 1) {
    long long k;
    cin >> k;
    arr.push_back(k);
  }
  long long count = 0;
  for (long long mask = 0; mask < (1 << n); mask++) {
    long long sum = 0;
    vector<long long> t;
    for (long long i = 0; i < n; i++) {
      if ((mask & (1 << i)) != 0) {
        t.push_back(arr[i]);
        sum += arr[i];
      }
    }
    if (sum <= r and sum >= l and t.size() > 1) {
      sort((t).begin(), (t).end());
      if (t.back() - t.front() >= x) count++;
    }
  }
  cout << count;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  mt19937 rng((unsigned long long)chrono::steady_clock::now()
                  .time_since_epoch()
                  .count());
  auto start = chrono::high_resolution_clock::now();
  long long tc = 1;
  for (long long t = 1; t <= tc; t++) {
    solve();
  }
  auto stop = chrono::high_resolution_clock::now();
  auto duration = chrono::duration_cast<chrono::microseconds>(stop - start);
  cerr << duration.count() << " ms\n";
}
