d = {} def f(x,i): if (x,i) in d: return d[x,i] if x < 0: return 0 if i==62: return 1 c = 0 if res[i]&1: c += f(x//2,i+1) if res[i]&2: c += f((x-1)//2,i+1) d[x,i] = c return c n,L,R = map(int,input().split()) *a, = map(int,input().split()) res = [3]*62 for x,y in zip(a,a[1:]): for i in range(62)[::-1]: if x>>i&1 != y>>i&1: res[i] &= 1<<(x>>i&1) break print(f(R,0)-f(L-1,0))