from copy import deepcopy N,K,X,Y=map(int,input().split()) A=list(map(int,input().split())) Mod=998244353 T=1023 Flag=set() for a in A: Flag.add(a) Z={a:[0]*(T+1) for a in Flag} DP=deepcopy(Z) for a in range(T+1): if a in Flag: DP[a][a]=1 for _ in range(N-1): ODP,DP=DP,deepcopy(Z) S=[0]*(T+1) for a in Flag: E=ODP[a] for x in range(T+1): S[x]+=E[x] S[x]%=Mod for i in Flag: E=DP[i] F=ODP[i] for x in range(T+1): E[x]=S[x^i]-F[x^i] B=0 for L in DP.values(): B+=sum(L[X:Y+1]) B%=Mod print(B)