#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int num[N], mum[N];
int n, m, q, t, l, r;
int top, ans, cnt;
void dfs(int sum, int d, int x, int minn) {
  if (sum >= l && sum <= r && d >= q) ans++;
  if (sum > r) return;
  for (int i = x; i <= n; ++i) {
    dfs(sum + num[i], num[i] - minn, i + 1, minn);
  }
}
int main() {
  while (cin >> n >> l >> r >> q) {
    ans = 0;
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; ++i) scanf("%d", &num[i]);
    sort(num + 1, num + 1 + n);
    for (int i = 1; i <= n; ++i) {
      dfs(num[i], 0, i + 1, num[i]);
    }
    printf("%d\n", ans);
  }
  return 0;
}
