#include <bits/stdc++.h>
using namespace std;
int n, l, r, x;
int c[16];
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  int ans = 0;
  for (int i = 0; i < (1 << n); ++i) {
    int mn = INT_MAX, mx = INT_MIN;
    int sum = 0;
    for (int j = 0; j < n; ++j) {
      if (((1 << j) & i) > 0) {
        mn = min(mn, c[j]);
        mx = max(mx, c[j]);
        sum += c[j];
      }
    }
    if (sum >= l && sum <= r && mx - mn >= x) {
      ++ans;
    }
  }
  cout << ans << "\n";
}
