#include using namespace std; using ll = long long; using PII = pair; #define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i) #define REP(i, n) FOR(i, 0, n) #define ALL(x) x.begin(), x.end() template void chmin(T &a, const T &b) { a = min(a, b); } template void chmax(T &a, const T &b) { a = max(a, b); } struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio; #ifdef DEBUG_ #include "../program_contest_library/memo/dump.hpp" #else #define dump(...) #endif const ll INF = 1LL<<60; int main(void) { ll n, l, r; cin >> n >> l >> r; vector> a(n); REP(i, n) { ll b; cin >> b; a[i] = bitset<64>(b); } // REP(i, n) cerr << a[i] << endl; vector> can(62); auto func = [&] { vector p; REP(i, 62) { ll idx = 0; vector> v(p.size()+1); REP(j, n) { if(idx<(ll)p.size() && p[idx]==j) idx++; v[idx].push_back(a[j].test(61-i)); } // if(i>=40) {dump(i); dump(p); dump(v);} ll sz = 0; bool ok0 = true, ok1 = true; for(auto vec: v) { ll turn = 0; REP(j, vec.size()) { if(turn==0 && vec[j]!=vec[0]) turn = 1, p.push_back(sz+j); else if(turn==1 && vec[j]==vec[0]) { cout << 0 << endl; exit(0); } } if(turn==1) { if(vec[0]==0) ok1 = false; else if(vec[0]==1) ok0 = false; } sz += vec.size(); } if(ok0) can[i].push_back(0); if(ok1) can[i].push_back(1); sort(ALL(p)); } }; auto solve = [&](ll x) -> ll { bitset<64> y(x); vector> dp(63, vector(2)); dp[0][0] = 1; REP(i, 62) REP(j, 2) { for(auto k: can[i]) { if(j==0 && k > y.test(61-i)) continue; dp[i+1][j || k