#include <bits/stdc++.h>
using namespace std;
long long n, l, r, d;
long long first(long long x, long long sum, long long maxi, long long mini,
                long long a[]) {
  if (x == n) {
    if ((sum >= l && sum <= r) && ((maxi - mini) >= d) && (maxi != INT_MAX) &&
        (mini != INT_MIN)) {
      return 1;
    } else
      return 0;
  }
  return first(x + 1, sum + a[x], max(maxi, a[x]), min(mini, a[x]), a) +
         first(x + 1, sum, maxi, mini, a);
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  cin >> n >> l >> r >> d;
  long long i, a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  cout << first(0, 0, INT_MIN, INT_MAX, a);
}
