#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, L, R, X, i, x, j, p, max, min;
  cin >> N >> L >> R >> X;
  long long int a[N + 5];
  for (i = 0; i < N; i++) cin >> a[i];
  sort(a, a + N);
  long long int count = 0;
  x = pow(2, N);
  for (i = 3; i < x; i++) {
    int b[20];
    p = log2(i);
    if (pow(2, p) != i) {
      p = i;
      for (j = 0; j <= N; j++) b[j] = 0;
      for (j = N; j >= 0; j--) {
        if (p >= pow(2, j)) {
          b[j] = 1;
          p = p - pow(2, j);
        } else
          b[j] = 0;
      }
      max = 0;
      min = 1000000009;
      long long int sum = 0;
      for (j = N - 1; j >= 0; j--) {
        if (b[j] == 1) {
          sum += a[N - 1 - j];
          if (min > a[N - 1 - j]) min = a[N - 1 - j];
          if (max < a[N - 1 - j]) max = a[N - 1 - j];
        }
      }
      if (sum <= R && sum >= L && (max - min) >= X) count += 1;
    }
  }
  cout << count << endl;
  return 0;
}
