#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using Int = long long; template ostream &operator<<(ostream &os, const pair &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template ostream &operator<<(ostream &os, const vector &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; } template void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; } template bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; } int N; vector A; int main() { scanf("%d", &N); A.resize(N); for (int i = 0; i < N; ++i) { scanf("%d", &A[i]); } int now = 0; for (int i = 0; i < N; ++i) { now ^= A[i]; } printf("%d\n", (now != 0) ? 1 : 0); fflush(stdout); for (; ; ) { if (now != 0) { for (int i = 0; i < N; ++i) { if (A[i] >= (A[i] ^ now)) { printf("%d %d\n", i + 1, A[i] - (A[i] ^ now)); fflush(stdout); A[i] ^= now; now = 0; break; } } int res; scanf("%d", &res); if (res == -1) exit(0); } { int i, k; scanf("%d%d", &i, &k); --i; now ^= A[i] ^ (A[i] - k); A[i] -= k; int res; scanf("%d", &res); if (res == -1) exit(0); } } return 0; }