#include #include using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<(int)(n);i++) int main(){ int n; cin>>n; vector a(n); rep(i,n) cin>>a.at(i); // A034798 vector dp={0, 1, 0, 2, 1, 1, 2, 2, 0, 1, 0, 3, 1, 1, 3, 3, 0, 2, 0, 2, 2, 2, 2, 2, 0, 3, 0, 3, 3, 3, 3, 3, 0, 2, 0, 2, 2, 2, 2, 2, 0, 3, 0, 3, 3, 3, 3, 3, 0, 2, 0, 2, 2, 2, 2, 2, 0, 3, 0, 3, 3, 3, 3, 3, 0, 1, 0, 3, 1, 1, 3, 3, 0, 1, 0, 3, 1, 1, 3, 3, 0, 3, 0, 3, 3, 3, 3, 3, 0, 3, 0, 3, 3, 3, 3, 3, 0, 3, 0, 3}; int d=0; int smx=0; rep(i,n){ if(a.at(i)<0){ d++; continue; } set st; rep(j,65){ if((a.at(i)>>j)&1) st.insert(dp.at(j)); } int mx=0; while(st.count(mx)) mx++; smx^=mx; } d%=2; if(d&&(smx==0)){ cout<<"1\n"; return 0; } if(smx) cout<<"1\n"; else cout<<"2\n"; }