#include <bits/stdc++.h>
using namespace std;
long long dp[(1 << 15) + 10][55];
int cnt = 0;
long long n, l, r, x;
long long c[50 + 10];
long long solve(long long mask, long long pos) {
  long long &ret = dp[mask][pos];
  if (ret != -1) return 0;
  ret = 0;
  if (pos >= n) {
    long long ma = -1;
    long long mi = INT_MAX;
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      if (mask & (1LL << i)) {
        ma = max(ma, c[i]);
        mi = min(mi, c[i]);
        sum += c[i];
      }
    }
    if (sum >= l && sum <= r && abs(ma - mi) >= x) return 1;
    return 0;
  }
  return ret = solve(mask | (1LL << pos), pos + 1) + solve(mask, pos + 1);
}
int main() {
  cin >> n >> l >> r >> x;
  for (int i = 0; i < n; i++) {
    cin >> c[i];
  }
  sort(c, c + n);
  memset(dp, -1, sizeof dp);
  cout << solve(0, 0);
  return 0;
}
