#include <bits/stdc++.h>
using namespace std;
const int lim = 1e6 + 3;
const int infinite = 1e9 + 11;
int n, l, r, x;
int ci[lim];
int cnt = 0;
int arr[lim];
void rec(int idx, int sum, int actives, int easiest, int hardest) {
  if (idx == n) {
    if (actives > 1) {
      if (sum >= l && sum <= r && hardest - easiest >= x) cnt++;
    }
    return;
  }
  rec(idx + 1, sum + ci[idx], actives + 1, min(easiest, ci[idx]),
      max(hardest, ci[idx]));
  rec(idx + 1, sum, actives, easiest, hardest);
}
void solve() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> ci[i];
  rec(0, 0, 0, infinite, 0);
  cout << cnt;
}
void open_file() { freopen("e:\\lmo.in", "r", stdin); }
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  solve();
}
