#include <bits/stdc++.h>

using namespace std;

int main() {
    bitset<64> bst;

    int q;
    cin >> q;
    while (q--) {
        int op;
        cin >> op;

        unsigned int idx = 0;
        if (op < 4) cin >> idx;

        switch (op) {
            case 0:
                cout << bst.test(idx) << endl;
                break;
            case 1:
                bst.set(idx);
                break;
            case 2:
                bst.reset(idx);
                break;
            case 3:
                bst.flip(idx);
                break;
            case 4:
                cout << bst.all() << endl;
                break;
            case 5:
                cout << bst.any() << endl;
                break;
            case 6:
                cout << bst.none() << endl;
                break;
            case 7:
                cout << bst.count() << endl;
                break;
            case 8:
                cout << bst.to_ullong() << endl;
                break;
            default:
                break;
        }
    }
    return 0;
}
