#include <bits/stdc++.h>
using namespace std;
const long long siz = 1e5;
const long long mod = 1e9 + 7;
const long long MAXX = 1e18;
long long n, l, r, x;
long long res[20][siz + 10];
vector<long long> hold;
long long cal(long long state) {
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    if (state & (1 << i)) {
      sum += hold[i];
    }
  }
  return sum;
}
long long diff(long long state) {
  long long a = MAXX, b = -MAXX;
  for (long long i = 0; i < n; i++) {
    if (state & (1 << i)) {
      a = min(a, hold[i]);
      b = max(b, hold[i]);
    }
  }
  return b - a;
}
long long dp(long long pos, long long state) {
  if (pos >= n) {
    long long sub = cal(state);
    if (sub >= l && sub <= r && __builtin_popcount(state) >= 2 &&
        diff(state) >= x) {
      return 1;
    }
    return 0;
  }
  if (res[pos][state] != -1) {
    return res[pos][state];
  }
  res[pos][state] = dp(pos + 1, state) + dp(pos + 1, state | (1 << pos));
  return res[pos][state];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  memset(res, -1, sizeof(res));
  cin >> n >> l >> r >> x;
  hold.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> hold[i];
  }
  sort(hold.begin(), hold.end());
  cout << dp(0, 0) << '\n';
  return 0;
}
