#include <bits/stdc++.h>
using namespace std;
int main() {
  int tries = 1;
  while (tries--) {
    long long n, l, r, xi;
    cin >> n >> l >> r >> xi;
    vector<long long> nums;
    long long size = n;
    while (n--) {
      long long num;
      cin >> num;
      nums.push_back(num);
    }
    int count = 0;
    for (int a = 0; a < pow(2, size); a++) {
      std::bitset<32> x(a);
      long long sum = 0;
      long long larg = 0;
      long long small = 99999999;
      for (int i = 0; i < x.size(); i++) {
        int val = x[i];
        if (val == 1) {
          if (i == 4) {
          }
          sum += nums[(size - 1) - i];
          if (nums[(size - 1) - i] > larg) larg = nums[(size - 1) - i];
          if (nums[(size - 1) - i] < small) {
            small = nums[(size - 1) - i];
          }
        }
      }
      if (sum >= l && sum <= r && (larg - small) >= xi) {
        count++;
      }
    }
    cout << count;
  }
  return 0;
}
