#include <bits/stdc++.h>
using namespace std;
long long int MOD1 = 1000000007;
long long int MOD2 = 998244353;
void yes() { cout << "YES" << endl; }
void no() { cout << "NO" << endl; }
long long int gcd(long long int a, long long int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long int lcm(long long int a, long long int b) {
  return (a * b / (gcd(a, b)));
}
void solve() {
  long long int n, l, r, x;
  cin >> n >> l >> r >> x;
  vector<long long int> arr(n);
  for (long long int i = 0; i <= n - 1; i++) cin >> arr[i];
  long long int ans = 0;
  sort(arr.begin(), arr.end());
  for (long long int i = 0; i < (1 << n); i++) {
    vector<long long int> brr;
    for (long long int j = 0; j < n; j++) {
      if ((i & (1 << j)) > 0) {
        brr.emplace_back(arr[j]);
      }
    }
    if (brr.size() > 1) {
      sort(brr.begin(), brr.end());
      long long int sum = 0;
      for (auto x : brr) {
        sum += x;
      }
      if ((brr[brr.size() - 1] - brr[0]) >= x && sum >= l && sum <= r) ans++;
    }
  }
  cout << ans << endl;
}
int main(int argc, const char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int tests = 1;
  while (tests--) {
    solve();
  }
  return 0;
}
