#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  int c[n];
  for (int i = 0; i < n; i++) cin >> c[i];
  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    int sum = 0, mn = 1e9, mx = -1e9;
    for (int j = 0; j < n; j++)
      if ((i & (1 << j)) != 0) {
        sum += c[j];
        mn = min(mn, c[j]);
        mx = max(mx, c[j]);
      }
    if (sum >= l && sum <= r && mx - mn >= x) ans++;
  }
  cout << ans;
  return 0;
}
