#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>
#include<bitset>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;


int main(){
  long ii,jj,kk;
  vector<int> a;
  bitset<64> flg;
  unsigned long long tmp;
  unsigned long long mask;
  int q;
  int c,i;
  flg = 0;
  cin >> q;

  for(ii=0;ii<q;ii++){
    cin >> c;
    switch(c){

    case 0:
      cin >> i;
      if(flg.test(i)){
        cout << 1 << endl;
      }
      else{
        cout << 0 << endl;
      }
      break;
    case 1:
      cin >> i;
      tmp = flg.to_ullong();
      //flg = flg |(1 << i);
      tmp = tmp |(1LL << i);
      flg = tmp;
      //flg.set(i);
      break;
    case 2:
      cin >> i;
      tmp = flg.to_ullong();
      tmp = tmp & ~(1LL << i);
      flg = tmp;
      //flg.reset(i);
      break;
    case 3:
      cin >> i;      
      tmp = flg.to_ullong();
      mask = (1LL << i);
      tmp = (tmp & ~(1LL << i)) | (mask ^ tmp);
      //tmp |= ((tmp & mask) ^ mask);
      flg = tmp;
      //flg.flip(i);
      break;
   case 4:
     tmp = flg.to_ullong();
     if(tmp == 0xffffffffffffffff){
     //if(flg.all()){
       cout << 1 << endl;
     }
     else{
       cout << 0 << endl;
     }
     break;
    case 5:
      tmp = flg.to_ullong();
      if(tmp != 0){
        cout << 1 << endl;
      }
      else{
        cout << 0 << endl;
      }      
      break;
    case 6:
      tmp = flg.to_ullong();
      if(tmp == 0){
        cout << 1 << endl;
      }
      else{
        cout << 0 << endl;
      }      
      break;
    case 7:
      cout << flg.count() << endl;
      break;
    case 8:
      cout << flg.to_ulong() << endl;
      break;
    }
  }
  return 0;
}

