#include <bits/stdc++.h>
using namespace std;
void a15hx() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, l, r, x;
  cin >> n >> l >> r >> x;
  long long diff[n];
  for (long long i = 0; i < n; i++) {
    cin >> diff[i];
  }
  long long ways = 0;
  for (long long i = 0; i < 1 << n; i++) {
    if (__builtin_popcount(i) >= 2) {
      long long tot_diff = 0, easy = INT32_MAX, hard = INT32_MIN;
      for (long long j = 0; j < n; j++) {
        if (i >> j & 1) {
          tot_diff += diff[j];
          easy = min(easy, diff[j]);
          hard = max(hard, diff[j]);
        }
      }
      if (tot_diff <= r && tot_diff >= l && hard - easy >= x) {
        ways++;
      }
    }
  }
  cout << ways;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  a15hx();
  return 0;
}
