#include "bits/stdc++.h" using namespace std; #define LL long long #define int LL #define PB push_back #define VI vector #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define REP(i,n) FOR(i, 0, (int)n - 1) #define PII pair #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define st first #define nd second template void mini(C & a4, C b4){a4 = min(a4, b4);} template void maxi(C & a4, C b4){a4 = max(a4, b4);} template void _dbg(const char * sdbg, TH h){ cerr< void _dbg(const char * sdbg, TH h, TA... a){ while(*sdbg!=',') cerr<<*sdbg++; cerr<<'='< ostream & operator<<(ostream & os, vector V){ os<<"[";for(auto vv: V) os < ostream & operator<<(ostream & os , pair P){ return os << "(" << P.st <<","<>n>>A>>B; VI x(n); REP(i, n){ cin>>x[i]; } sort(ALL(x), greater()); mini(A, x[0]); mini(B, x[0]); int total = 0; for(int y: x){ total ^= y % (min(A,B) + 1); } if(A == B){ ans(total != 0); } if(x.size() >= 2 && x[1] > min(A,B)){ ans(A > B); } if(A > B){ ans(1); } if(x[0] > 2 * A){ ans(0); } int total2 = total ^ (x[0] % (A + 1)); if(total == 0){ ans(0); } if(total2 > A || x[0] - total2 > A){ ans(0); } else{ ans(1); } }