#include <bits/stdc++.h>
int a[25], l, r, x, i, j, n, ans;
int main() {
  scanf("%d %d %d %d", &n, &l, &r, &x);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < (1 << n); i++) {
    int s = 0;
    int max = 0, min = 1e9;
    for (j = 0; j < n; j++) {
      if ((i >> j) & 1) {
        if (a[j] > max) max = a[j];
        if (min > a[j]) min = a[j];
        s += a[j];
      }
    }
    if (l <= s && s <= r && max - min >= x) ans++;
  }
  printf("%d", ans);
  return 0;
}
