#include <bits/stdc++.h>
using namespace std;
const long long maxn = 3e5 + 10;
long long N, L, R, X, arr[maxn], ans;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> L >> R >> X;
  for (register long long i = 1; i <= N; ++i) {
    cin >> arr[i];
  }
  for (register long long i = 0; i < (1 << N); ++i) {
    long long cnt = __builtin_popcount(i);
    if (i < 2) continue;
    vector<long long> v;
    for (register long long j = 0; j < N; ++j) {
      if (i & 1 << j) {
        v.push_back(arr[j + 1]);
      }
    }
    sort(v.begin(), v.end());
    if (v.back() - v.front() < X) {
      continue;
    }
    long long sum = accumulate(v.begin(), v.end(), 0);
    if (sum < L || sum > R) {
      continue;
    }
    ++ans;
  }
  cout << ans << endl;
  return 0;
}
