#include <bits/stdc++.h>
using namespace std;
int a[15];
int n, l, r, x;
int total = 0;
void f(int now, int min, int max, int sum, int num) {
  if (now == n) return;
  for (int i = now; i < n; i++) {
    int min1, max1, num1;
    int sum1;
    min1 = a[i] < min ? a[i] : min;
    max1 = a[i] > max ? a[i] : max;
    sum1 = sum + a[i];
    num1 = num + 1;
    if (num1 == 1) {
      f(i + 1, min1, max1, sum1, num1);
    } else {
      if (sum1 >= l && sum1 <= r && max1 - min1 >= x) {
        total++;
        f(i + 1, min1, max1, sum1, num1);
      } else {
        if (sum1 <= r) f(i + 1, min1, max1, sum1, num1);
      }
    }
  }
}
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  f(0, 1000000000, 0, 0, 0);
  cout << total;
  return 0;
}
