#include <bits/stdc++.h>
using namespace std;
const int inf = 1000 * 2000 * 1000, MOD = 1000 * 1000 * 1000 + 7;
const long long INF = 1000 * 1LL * 1000000 * 1000 * 1000000;
int n, l, r, x, a[2000], ans;
int len(int p) {
  int leng = 0;
  for (int i = 0; i < n; i++) {
    if ((p & (1 << i)) > 0) {
      leng++;
    }
  }
  return leng;
}
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < (1 << n); i++) {
    if (len(i) > 1) {
      int mn = inf, mx = -1, sum = 0;
      for (int j = 0; j < n; j++) {
        if ((i & (1 << j)) > 0) {
          mn = min(mn, a[j + 1]);
          mx = max(mx, a[j + 1]);
          sum += a[j + 1];
        }
      }
      cerr << mn << " " << mx << " " << sum << endl;
      if (mx - mn >= x && sum >= l && sum <= r) {
        ans++;
      }
    }
  }
  cout << ans;
  return 0;
}
