#include <bits/stdc++.h>
using namespace std;
long long a[16], d[40000], vis[40000];
int main() {
  ios::sync_with_stdio(0);
  int n, x, i, j, k, l0, m, m0, m1, c;
  long long l, r, v, ans = 0;
  cin >> n >> l >> r >> x;
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (i = 1, m = 1; i <= n; i++) {
    m0 = m;
    for (j = 0; j < m0; j++, m++) {
      m1 = m;
      c = 1;
      while (!(m1 & 1)) c++, m1 = m1 >> 1;
      d[m] = a[i] + d[j];
      if (j && a[i] - a[c] >= x) vis[m] = 1;
      if (vis[m] && d[m] >= l && d[m] <= r) ans++;
    }
  }
  cout << ans;
}
