#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n, l, r, x;
  cin >> n >> l >> r >> x;
  long long c[n];
  for (long long i = 0; i < n; i++) cin >> c[i];
  long long ans = 0;
  for (long long i = 0; i < (1 << n); i++) {
    long long mn = INT_MAX;
    long long mx = 0;
    bool ok = true;
    long long dif = 0;
    for (long long j = 0; j < n; j++) {
      if (i & (1 << j)) {
        mx = max(mx, c[j]);
        mn = min(mn, c[j]);
        dif += c[j];
      }
    }
    ans += (dif >= l && dif <= r && mx - mn >= x);
  }
  cout << ans << "\n";
}
