#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x, sum = 0, cnt = 0;
  cin >> n >> l >> r >> x;
  int arr[n];
  vector<int> v;
  for (int y = 0; y < n; y++) cin >> arr[y];
  for (int i = 1; i < (1 << n); i++) {
    sum = 0;
    for (int j = 0; j < n; j++)
      if ((i >> j) & 1) {
        v.push_back(arr[j]);
        sum = sum + arr[j];
      }
    if (v.size() >= 2 && sum >= l && sum <= r) {
      sort(v.begin(), v.end());
      if ((v[v.size() - 1] - v[0]) >= x) cnt++;
    }
    v.clear();
  }
  cout << cnt;
  return 0;
}
