#include <bits/stdc++.h>
using namespace std;
const int maxn = 20;
int c[maxn], vis[20], res[20];
int n, l, r, x, a, cnt, cur;
void dfs(int k, int sum) {
  if (sum >= l && sum <= r && c[res[cur - 1]] - c[res[0]] >= x) cnt++;
  if (sum > r) return;
  for (int i = k; i < n; i++)
    if (!vis[i] || sum == 0) {
      vis[i] = 1;
      res[cur++] = i;
      dfs(i, sum + c[i]);
      vis[i] = 0;
      cur--;
    }
}
int main() {
  cin >> n >> l >> r >> x;
  cur = cnt = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &c[i]);
  }
  sort(c, c + n);
  dfs(0, 0);
  printf("%d\n", cnt);
  return 0;
}
