#include <bits/stdc++.h>
using namespace std;
long long ans = 0;
void add(long long c[], long long n, long long r, long long l, long long sum,
         long long end, long long pos, long long test) {
  if (sum >= l && sum <= r && test == 1) {
    ans++;
  }
  if (pos < end) {
    add(c, n, r, l, sum, end, pos + 1, 0);
    add(c, n, r, l, sum + c[pos], end, pos + 1, 1);
  } else
    return;
}
void solve(long long c[], long long n, long long r, long long l,
           long long count1, long long count2, long long x) {
  for (long long i = count2; i < n - count1; ++i) {
    for (long long j = 0; j < i; ++j) {
      if ((c[i] - c[j]) >= x) add(c, n, r, l, c[i] + c[j], i, j + 1, 1);
    }
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, l, r, x;
  cin >> n >> l >> r >> x;
  long long c[n], count1 = 0, count2 = 0;
  for (long long i = 0; i < n; ++i) {
    cin >> c[i];
    if (c[i] >= r) count1++;
    if (c[i] <= x) count2++;
  }
  sort(c, c + n);
  solve(c, n, r, l, count1, count2, x);
  cout << ans;
  return 0;
}
