#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  long long ans = 0;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long mask = 0; mask < (long long)1 << n; mask++) {
    int mn = 1e6 + 1;
    int mx = 0;
    long long tot = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (long long)1 << i) {
        tot += arr[i];
        mn = min(mn, arr[i]);
        mx = max(mx, arr[i]);
      }
    }
    if (tot >= l && tot <= r && (mx - mn) >= x) ans++;
  }
  cout << ans;
  return 0;
}
