#include <bits/stdc++.h>
using namespace std;
long long a[20], l, r, x;
int vis[20] = {0};
int ans = 0, n;
void solve(int i, int n) {
  if (i == n) {
    vector<long long> vec;
    long long s = 0;
    for (int i = 0; i < n; ++i)
      if (vis[i]) s += a[i], vec.push_back(a[i]);
    if (vec.size() == 0) return;
    long long mx = *max_element(vec.begin(), vec.end());
    long long mn = *min_element(vec.begin(), vec.end());
    if (vec.size() >= 2 && mx - mn >= x && s >= l && s <= r) ++ans;
    return;
  }
  vis[i] = 1;
  solve(i + 1, n);
  vis[i] = 0;
  solve(i + 1, n);
}
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; ++i) cin >> a[i];
  solve(0, n);
  cout << ans;
  return 0;
}
