#include <bits/stdc++.h>
using namespace std;
void edit(vector<int> &skill, int n) {
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    skill.push_back(x);
  }
}
void achilles() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  vector<int> diff;
  int ans = 0;
  edit(diff, n);
  sort(diff.begin(), diff.end());
  for (int i = 1; i < 1 << n; i++) {
    vector<int> rating;
    int sm = 0;
    for (int k = 0; k < n; k++) {
      if (i & (1 << k)) {
        rating.push_back(diff[k]);
        sm += diff[k];
      }
    }
    auto mx = *max_element(rating.begin(), rating.end());
    auto mn = *min_element(rating.begin(), rating.end());
    if (mx - mn >= x) {
      if (sm >= l && sm <= r) {
        ans++;
      }
    }
  }
  cout << ans << "\n";
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  achilles();
  return 0;
}
