#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, l = 0, r = 0, x = 0, c[16];
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> c[i];
  sort(c, c + n);
  int total = 0, cnt = 0, ret = 0, easy = 0, hard = 0;
  for (int i = 0; i < (1 << n); i++) {
    total = 0, cnt = 0;
    for (int j = 0; j < n; j++) {
      if ((1 << j) & i) {
        if (cnt == 0) {
          easy = c[j];
        }
        total += c[j];
        cnt++;
        hard = c[j];
      }
    }
    if (cnt > 1 && total >= l && total <= r && hard - easy >= x) {
      ret++;
    }
  }
  cout << ret;
  return 0;
}
