#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
void solve(long long& n, long long& l, long long& r, long long& x, long long i,
           long long f, long long sum, vector<int>& v) {
  if (i >= n) return;
  solve(n, l, r, x, i + 1, f, sum, v);
  sum += v[i];
  if (f == 0) f = v[i];
  if (sum >= l && sum <= r && v[i] - f >= x) ans++;
  if (sum > r) return;
  solve(n, l, r, x, i + 1, f, sum, v);
}
int main() {
  long long n, l, r, x, k = 0, sum = 0;
  cin >> n >> l >> r >> x;
  vector<int> v(n);
  for (long long i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  solve(n, l, r, x, k, k, sum, v);
  cout << ans;
  return 0;
}
