#include <bits/stdc++.h>
using namespace std;
int n, l, r, x, p[20], ind, ans[20], sum, cnt = 0;
bool check() { return (sum >= l && sum <= r && (ans[ind - 1] - ans[0] >= x)); }
int main() {
  scanf("%d%d%d%d", &n, &l, &r, &x);
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
  }
  sort(p, p + n);
  for (int mask = 0; mask < (1 << n); mask++) {
    ind = 0;
    sum = 0;
    fill(ans, ans + 20, 0);
    for (int bit = 0; bit < n; bit++) {
      if ((((mask) >> (bit)) & 1)) {
        sum += p[bit];
        ans[ind] = p[bit];
        ind++;
      }
    }
    if (check()) {
      cnt++;
    }
  }
  printf("%d", cnt);
}
