#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x, cnt = 0;
  cin >> n >> l >> r >> x;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int mask = 0; mask < 1 << n; mask++) {
    long long sum = 0;
    int p = -2e9, q = 2e9;
    for (int i = 0; i < n; i++)
      if (mask >> i & 1) {
        sum += v[i];
        p = max(p, v[i]);
        q = min(q, v[i]);
      }
    if (p - q >= x && sum >= l && sum <= r) cnt++;
  }
  cout << cnt << endl;
}
