#include <bits/stdc++.h>
using namespace std;
long long n, l, r, x, ans = 0, a;
vector<long long> v;
vector<long long> k;
vector<vector<long long> > u;
void call(int i, long long sum) {
  if (i == v.size()) {
    if (sum >= l && sum <= r) u.push_back(k);
    return;
  }
  k.push_back(v[i]);
  call(i + 1, sum + v[i]);
  k.pop_back();
  call(i + 1, sum);
}
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0), cout.tie(0);
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  call(0, 0);
  for (int i = 0; i < u.size(); ++i) {
    if (u[i][u[i].size() - 1] - u[i][0] >= x) ans++;
  }
  cout << ans << endl;
  return 0;
}
