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