#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 205

int N;
int dp[NUM][NUM];

int grundy(int num_white,int num_black){

	if(dp[num_white][num_black] != -1)return dp[num_white][num_black];

	set<int> S;

	if(num_white > 0){
		S.insert(grundy(num_white-1,num_black));
	}

	for(int i = 1; i <= min(num_black,num_white); i++){
		S.insert(grundy(num_white,num_black-i));
	}

	if(num_black > 0){
		S.insert(grundy(num_white+1,num_black-1));
	}

	int ret = 0;
	while(S.count(ret) != 0)ret++;

	return dp[num_white][num_black] = ret;
}

int main(){

	scanf("%d",&N);

	int num_white,num_black;
	int number = 0;

	for(int i = 0; i < NUM; i++){
		for(int k = 0; k < NUM; k++){
			dp[i][k] = -1;
		}
	}

	for(int loop = 0; loop < N; loop++){

		scanf("%d %d",&num_white,&num_black);

		number ^= grundy(num_white,num_black);
	}

	if(number != 0){

		printf("0\n");
	}else{

		printf("1\n");
	}

	return 0;
}

