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