mod = 1000000007 eps = 10**-9 def main(): import sys from collections import deque input = sys.stdin.readline N, K, x, y = map(int, input().split()) A = list(map(int, input().split())) A = list(set(A)) K = len(A) que = deque() for i in range(K): que.append([A[i]]) while len(que[0]) < N: B = que.popleft() for a in A: if a != B[-1]: que.append(B[:] + [a]) ans = 0 while que: B = que.pop() z = 0 for b in B: z ^= b if x <= z <= y: ans += 1 print(ans) if __name__ == '__main__': main()