#include <bits/stdc++.h>
using namespace std;
long long const mod = 1e9 + 7;
long long const N = 1e11 + 2;
long long l, r, n, x, a[19] = {}, sum = 0, sol = 0;
vector<long long> v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < (1 << n); i++) {
    sum = 0;
    for (int j = 0; j < n; j++) {
      if ((i & (1 << j)) > 0) {
        sum += a[j];
        v.push_back(a[j]);
      }
    }
    if (v.size() > 1 && sum >= l && sum <= r && (v[v.size() - 1] - v[0]) >= x)
      sol++;
    v.clear();
  }
  cout << sol << endl;
  return 0;
}
