#include <bits/stdc++.h>
using namespace std;
int n, l, r, x;
int c[20];
int ans = 0;
void dp(int idx, int count, int diff, int mn, int mx, bool ch) {
  if (count >= 2 && diff >= l && diff <= r && (mx - mn) >= x && ch) ans++;
  if (idx == n) {
    return;
  }
  dp(idx + 1, count, diff, mn, mx, 0);
  dp(idx + 1, count + 1, diff + c[idx], min(mn, c[idx]), max(mx, c[idx]), 1);
}
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; ++i) {
    cin >> c[i];
  }
  dp(0, 0, 0, 10000007, -1, 1);
  cout << ans << endl;
}
