#include using namespace std; int N; int A[2<<17],B[2<<17]; main() { cin>>N; for(int i=0;i<=2*N;i++)cin>>A[i]; bool ok=true; for(int i=0;i<2*N;i++) { B[i]=(A[i+1]-A[i]+3)%3; if(B[i]==0)ok=false; } for(int i=0;i<2*N;i+=2)if(B[i]!=B[i+1]||i>0&&B[i]==B[i-1])ok=false; if(ok) { cout<<(B[0]==1^N%2==1?2:1)<