#include <bits/stdc++.h>
using namespace std;
long long n, l, r, x, a[20], ans;
bool vis[30000009];
void solve(long long mask, long long diff, long long num, long long hard,
           long long easy) {
  if (diff > r) return;
  if (diff >= l && diff <= r && num >= 2 && abs(hard - easy) >= x) {
    if (!vis[mask]) ans++;
  }
  if (vis[mask]) return;
  vis[mask] = 1;
  if (mask == pow(2, n) - 1) return;
  for (int i = 0; i < n; i++) {
    if ((mask & (1 << i))) continue;
    solve((mask | (1 << i)), diff + a[i], num + 1, max(hard, a[i]),
          min(easy, a[i]));
  }
}
int main() {
  scanf("%lld%lld%lld%lld", &n, &l, &r, &x);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  if (n == 1) {
    printf("0");
    return 0;
  }
  solve(0, 0, 0, 0, 1e13);
  printf("%lld\n", ans);
  return 0;
}
