#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, x, r;
  cin >> n >> l >> r >> x;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    int tmp = i;
    int k = 0;
    long long sum = 0, u = 0;
    long long maxi = 0, mini = 2e9;
    while (tmp > 0) {
      if (tmp % 2 == 1) {
        sum += a[k];
        u++;
        maxi = max(maxi, (long long)a[k]);
        mini = min(mini, (long long)a[k]);
      }
      k++;
      tmp /= 2;
    }
    if (u >= 2 && sum >= l && sum <= r && maxi - mini >= x) ans++;
  }
  cout << ans << endl;
}
