#include #define rep(i, n) for (int i = 0; i < (n); ++i) using namespace std; using ll = long long; int main() { cin.tie(nullptr) -> sync_with_stdio(false); int n; ll l, r; cin >> n >> l >> r; vector a(n); rep(i, n) cin >> a[i]; for (auto &x : a) cin >> x; vector need(61, -1); rep(i, n-1) { ll d = a[i]^a[i+1]; int k = 63 - __builtin_clzll(d); int b = a[i]>>k&1; if (need[k] != -1 and need[k] != b) { cout << 0 << '\n'; return 0; } need[k] = b; } vector ways(62, 1); rep(k, 61) ways[k+1] = ways[k]*(need[k] == -1 ? 2 : 1); auto calc = [&](ll x) -> ll { if (x < 0) return 0; ll res = 0; for (int k = 60; k >= 0; --k) { int b = x>>k&1; if (b and need[k] != 1) res += ways[k]; if (need[k] != -1 and need[k] != b) return res; } return res+1; }; cout << calc(r) - calc(l-1) << '\n'; return 0; }