#include <bits/stdc++.h>
using namespace std;
const long long Maxn = 10000;
const long double pi = acos(-1);
const long long mod = 1000000007;
template <class T>
ostream &operator<<(ostream &out, vector<T> &A) {
  for (auto x : A) out << x << " ";
  return out;
}
template <class T>
ostream &operator<<(ostream &out, set<T> &A) {
  for (auto x : A) out << x << " ";
  return out;
}
template <class T1, class T2>
T1 powr(T1 a, T2 b) {
  T1 res = 1;
  for (long long i = 1; i < b + 1; i++) res = res * a;
  return res;
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, l, r, x;
  while (cin >> n >> l >> r >> x) {
    vector<long long> k(n);
    for (long long i = 0; i < n; i++) {
      cin >> k[i];
    }
    long long cnt = 0;
    for (long long i = 0; i < (1 << n); i++) {
      long long mi = 1000000;
      long long ma = -1;
      long long sum = 0;
      for (long long j = 0; j < n; j++) {
        if (i & (1 << j)) {
          sum = sum + k[j];
          ma = max(ma, k[j]);
          mi = min(mi, k[j]);
        }
      }
      if (l <= sum && sum <= r && (ma - mi) >= x) {
        cnt++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
