#include <bits/stdc++.h>
using namespace std;
int ans, n, l, r, x;
int a[20];
void DFS(int indx, int minl, int maxl, int sum) {
  if (indx == n + 1) return;
  if (sum >= l && sum <= r && (maxl - minl) >= x && indx == n) ans++;
  DFS(indx + 1, min(minl, a[indx]), max(maxl, a[indx]), sum + a[indx]);
  DFS(indx + 1, minl, maxl, sum);
  return;
}
int main() {
  while (~scanf("%d%d%d%d", &n, &l, &r, &x)) {
    for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
    ans = 0;
    DFS(0, 9999999099, 0, 0);
    printf("%d\n", ans);
  }
  return 0;
}
