#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;


int main(){

	int num_query;
	scanf("%d",&num_query);

	int command,digit;

	bitset<64> B(0);

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

		scanf("%d",&command);

		switch(command){
		case 0:
			scanf("%d",&digit);
			printf("%d\n",B.test(digit));
			break;
		case 1:
			scanf("%d",&digit);
			B.set(digit);
			break;
		case 2:
			scanf("%d",&digit);
			B.reset(digit);
			break;
		case 3:
			scanf("%d",&digit);
			B.flip(digit);
			break;
		case 4:
			if(B.all()){
				printf("1\n");
			}else{
				printf("0\n");
			}
			break;
		case 5:
			if(B.any()){
				printf("1\n");
			}else{
				printf("0\n");
			}
			break;
		case 6:
			if(B.none()){
				printf("1\n");
			}else{
				printf("0\n");
			}
			break;
		case 7:
			printf("%d\n",B.count());
			break;
		case 8:
			printf("%llu\n",B.to_ulong());
			break;
		}
	}

	return 0;
}


