#include <bits/stdc++.h>
using namespace std;
int const N = 2e5 + 5, M = 17 + 5, MOD = 998244353, OO = 0x3f3f3f3f;
long double const ESP = 1e-11;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, l, r, x, ans = 0;
  cin >> n >> l >> r >> x;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int mask = 0; mask < (1 << n); mask++) {
    int sum = 0, mn = INT_MAX, mx = INT_MIN, cnt = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        sum += arr[i];
        cnt++;
        mn = min(mn, arr[i]);
        mx = max(mx, arr[i]);
      }
    }
    if (cnt >= 2 && sum >= l && sum <= r && mx - mn >= x) ans++;
  }
  cout << ans << '\n';
  return 0;
}
