n, l, r, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
cnt = 0
def go(index, q):
global cnt
if index == n:
if len(q) >= 2:
if l <= sum(q) <= r and q[-1]-q[0] >= x:
cnt += 1
return
go(index+1, q+[a[index]])
go(index+1, q)
go(0, [])
print(cnt)
n제한이 15라 먼저 sort해주었다 (나중에 최대 최소 ㅃㅏ르게 하려고...?)