#include using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) #define rep1(i, n) for(int i = 1; i <= (n); i++) #define co(x) cout << (x) << "\n" #define cosp(x) cout << (x) << " " #define ce(x) cerr << (x) << "\n" #define cesp(x) cerr << (x) << " " #define pb push_back #define mp make_pair #define Would #define you #define please int main() { cin.tie(0); ios::sync_with_stdio(false); ll N, L, R; cin >> N >> L >> R; L--; ll A[200000]; rep(i, N) cin >> A[i]; ll dp1[62][2] = {}, dp2[62][2]; dp1[61][0] = 1; dp2[61][0] = 1; vector kireme, kireme2; kireme.pb(0); kireme.pb(N); int dame = 0; for (int i = 60; i >= 0; i--) { int K = kireme.size() - 1; kireme2.clear(); int agari = 0; int sagari = 0; rep(j, K) { kireme2.pb(kireme[j]); int mae = A[kireme[j]] >> i & 1; for (int k = kireme[j] + 1; k < kireme[j + 1]; k++) { if (mae != (A[k] >> i & 1)) { if (mae) sagari = 1; else agari = 1; mae = A[k] >> i & 1; kireme2.pb(k); } } } kireme2.pb(N); kireme = kireme2; if (agari && sagari) dame = 1; else if (agari) { if (L >> i & 1) dp1[i][1] = dp1[i + 1][0]; else dp1[i][0] = dp1[i + 1][0]; dp1[i][1] += dp1[i + 1][1]; if (R >> i & 1) dp2[i][1] = dp2[i + 1][0]; else dp2[i][0] = dp2[i + 1][0]; dp2[i][1] += dp2[i + 1][1]; } else if (sagari) { if (L >> i & 1) dp1[i][0] = dp1[i + 1][0]; dp1[i][1] += dp1[i + 1][1]; if (R >> i & 1) dp2[i][0] = dp2[i + 1][0]; dp2[i][1] += dp2[i + 1][1]; } else { if (L >> i & 1) dp1[i][1] = dp1[i + 1][0]; else dp1[i][0] = dp1[i + 1][0]; dp1[i][1] += dp1[i + 1][1]; if (R >> i & 1) dp2[i][1] = dp2[i + 1][0]; else dp2[i][0] = dp2[i + 1][0]; dp2[i][1] += dp2[i + 1][1]; if (L >> i & 1) dp1[i][0] += dp1[i + 1][0]; dp1[i][1] += dp1[i + 1][1]; if (R >> i & 1) dp2[i][0] += dp2[i + 1][0]; dp2[i][1] += dp2[i + 1][1]; } } //rep(j, N) { // for (int i = 12; i >= 0; i--) { // cerr << (A[j] >> i & 1); // } // ce(""); //} if (L == -1) co(dp2[0][0] + dp2[0][1]); else co(dp2[0][0] + dp2[0][1] - dp1[0][0] - dp1[0][1]); Would you please return 0; }