#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  vector<int> a(n);
  for (int &x : a) {
    cin >> x;
  }
  sort(a.begin(), a.end());
  int MAX_MASK = (1 << n);
  int ans = 0;
  for (int mask = 0; mask < MAX_MASK; ++mask) {
    int fst = -1, scnd = -1;
    int sum = 0;
    for (int bit = 1, pos = 0; bit <= mask; bit <<= 1, ++pos) {
      if (bit & mask) {
        sum += a[pos];
        if (fst == -1) {
          fst = a[pos];
        }
        scnd = a[pos];
      }
    }
    if (scnd - fst >= x && l <= sum && sum <= r) {
      ++ans;
    }
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
