#include using namespace std; using ll = long long; ll gr[66]; ll grundy(ll a) { if (a == 0) { return gr[0] = 0; } if (a < 0) { a *= -1; return (a & 1 ? (ll)1e18 : 0ll); } if (a < 60 && gr[a] != -1) { return gr[a]; } int A[66]; fill(A, A + 66, 0); for (int i = 0; i < 60; i ++) { if ((a >> i) & 1) { A[grundy(i)] = 1; } } int ret = 0; while (A[ret]) ret ++; if (a < 60) { gr[a] = ret; } return ret; } int main () { fill(gr, gr + 60, -1); int N; cin >> N; ll xx = 0; for (int i = 0; i < N; i ++) { ll a; cin >> a; xx ^= grundy(a); } cout << (xx ? 1 : 2) << endl; }