#include <bits/stdc++.h>
using namespace std;
int n, l, r, x, ans = 0, a;
int v[16];
void recursive(int a, int sum, int f, int m) {
  if (a <= n) {
    if (l <= sum && sum <= r && m - f >= x && m) ans++;
    for (int i = a; i < n; i++) {
      recursive(i + 1, sum + v[i], f, v[i]);
    }
  }
}
int main() {
  scanf("%d%d%d%d", &n, &l, &r, &x);
  for (int i = 0; i < n; i++) scanf("%d", &v[i]);
  sort(v, v + n);
  for (int i = 0; i < n; i++) {
    recursive(i + 1, v[i], v[i], 0);
  }
  printf("%d\n", ans);
  return 0;
}
