#include // #include using namespace std; using namespace numbers; int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); int n; cin >> n; vector a(n); copy_n(istream_iterator(cin), n, a.begin()); vector dp(62); auto grundy = [&](long long x)->int{ vector found; for(auto y = 0; 1LL << y <= x; ++ y){ if(x & 1LL << y){ found.push_back(dp[y]); } } ranges::sort(found); found.erase(unique(found.begin(), found.end()), found.end()); found.push_back(1e9); int res = 0; while(res == found[res]){ ++ res; } return res; }; for(auto x = 1; x < 62; ++ x){ dp[x] = grundy(x); } int g = 0, cnt = 0; for(auto x: a){ if(x < 0){ cnt ^= 1; } else{ g ^= grundy(x); } } cnt || g ? cout << "1\n" : cout << "2\n"; return 0; } /* */ //////////////////////////////////////////////////////////////////////////////////////// // // // Coded by Aeren // // // ////////////////////////////////////////////////////////////////////////////////////////