#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 20;
int n, l, r, x;
int t[15];
int f(int i, int m, int M, int s) {
  if (i == n) return M - m >= x && l <= s && s <= r;
  return f(i + 1, m, M, s) + f(i + 1, min(m, t[i]), max(M, t[i]), s + t[i]);
}
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) cin >> t[i];
  cout << f(0, INF, 0, 0) << endl;
  return 0;
}
