#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, r, x, i, j, ar[35], ans = 0, min = 10000007, max = 0, k, h, sum;
  cin >> n >> l >> r >> x;
  for (i = 0; i < n; i++) cin >> ar[i];
  k = (1 << n);
  for (i = 1; i < k; i++) {
    sum = 0;
    min = 10000007;
    max = 0;
    for (j = 0; j < n; j++) {
      h = (1 << j);
      if (i & h) {
        sum += ar[j];
        if (ar[j] < min) min = ar[j];
        if (ar[j] > max) max = ar[j];
      }
    }
    if (sum >= l && sum <= r && (max - min) >= x) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
