#include <bits/stdc++.h>
const int MAXN = 15 + 5;
const int INF = ~0U >> 2;
int n, l, r, x;
int a[MAXN];
int ans = 0;
using std::max;
using std::min;
void dfs(int cur, int sum, int num, int mn, int mx) {
  if (sum >= l && sum <= r && num >= 2 && mx - mn >= x) ++ans;
  for (int i = cur; i < n; ++i)
    dfs(i + 1, sum + a[i], num + 1, min(mn, a[i]), max(mx, a[i]));
}
int main() {
  scanf("%d%d%d%d", &n, &l, &r, &x);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  std::sort(a, a + n);
  dfs(0, 0, 0, INF, -1);
  printf("%d\n", ans);
  return 0;
}
