#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x;
  cin >> n >> l >> r >> x;
  int c[n];
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  sort(c, c + n);
  long long cnt = 0, a = -1, b = -1;
  for (int i = 1; i <= (1LL << n); ++i) {
    long long sum = 0;
    for (int j = 0; j < n; ++j) {
      if ((1LL << j) & i) {
        sum += c[j];
        if (a == -1)
          a = j;
        else
          b = j;
      }
    }
    if (sum >= l && sum <= r && b != -1 && a != -1) {
      if ((c[b] - c[a]) >= x) ++cnt;
    }
    a = -1;
    b = -1;
  }
  cout << cnt << '\n';
}
