N, L, R = map(int, input().split()) A = tuple(map(int, input().split())) table = [None] * 61 def is_impossible(flag): if flag: print(0);exit() def set_table(x, q): if table[x] is None: table[x] = q else: is_impossible(table[x] != q) for i in range(N - 1): diff = A[i + 1] - A[i] x = A[i + 1] ^ A[i] is_impossible(diff == 0) if diff > 0: set_table(x.bit_length() - 1, 0) elif diff < 0: set_table(x.bit_length() - 1, 1) def f(x): if x < 0: return 0 dp_same, dp_smaller = 1, 0 for i in range(60, -1, -1): t = table[i] if (x >> i) & 1: if t is None: dp_smaller = dp_same + dp_smaller * 2 elif t == 0: dp_same, dp_smaller = 0, dp_same + dp_smaller else: if t is None: dp_smaller *= 2 elif t == 1: dp_same = 0 return dp_same + dp_smaller print(f(R) - f(L - 1))