#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, M = 1e8, OO = 0x3f3f3f3f;
int n, x, l, r, a[20], cnt, mn, mx;
vector<int> v;
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < (1 << n); i++) {
    int sum = 0;
    mn = 1e8;
    mx = 0;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        sum += a[j];
        mn = min(mn, a[j]);
        mx = max(mx, a[j]);
      }
    }
    if (mx - mn >= x && i != 0) {
      if (sum >= l && sum <= r) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
