#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  sort(a, a + n);
  for (int i = 0; i < pow(2, n); i++) {
    int temp = 0, M = -1, m = 99999999;
    for (int j = 0; j < n; j++) {
      if (i & 1 << j) {
        temp += a[j];
        M = max(M, a[j]);
        m = min(m, a[j]);
      }
    }
    if (temp >= l && temp <= r && (M - m) >= x) ans++;
  }
  cout << ans;
  return 0;
}
