import sys readline=sys.stdin.readline N,L,R=map(int,readline().split()) A=list(map(int,readline().split())) bit_lst=[None for bit in range(62)] for i in range(1,N): bit=(A[i-1]^A[i]).bit_length()-1 if A[i-1]>>bit&1 and not A[i]>>bit&1: if bit_lst[bit]==0: print(0) exit() bit_lst[bit]=1 elif not A[i-1]>>bit&1 and A[i]>>bit&1: if bit_lst[bit]==1: print(0) exit() bit_lst[bit]=0 def cnt(N): retu=0 for bit in range(62): if N>>bit&1 and bit_lst[bit]!=1: for i in range(bit+1,62): if bit_lst[i]!=None and bit_lst[i]!=N>>i&1: break else: retu+=pow(2,bit_lst[:bit].count(None)) return retu ans=cnt(R+1)-cnt(L) print(ans)