#include <bits/stdc++.h>
using namespace std;
int n;
int ans;
int l, r, x;
int c[15];
void dfs(int num, int min, int max, int total, int nump) {
  if (num == n) {
    if (total <= r && total >= l && nump >= 2 && max - min >= x) {
      ans++;
      return;
    } else
      return;
  }
  dfs(num + 1, min, max, total, nump);
  if (min > c[num]) min = c[num];
  if (max < c[num]) max = c[num];
  dfs(num + 1, min, max, total + c[num], nump + 1);
  return;
}
int main() {
  int i;
  scanf("%d%d%d%d", &n, &l, &r, &x);
  for (i = 0; i < n; i++) {
    scanf("%d", c + i);
  }
  dfs(0, 1000000000, 0, 0, 0);
  printf("%d\n", ans);
  return 0;
}
