#include<bits/stdc++.h>
#include <iostream>
using namespace std;

unsigned int power(int i){
    return 1 << i;
}
unsigned int one_counts[32];
unsigned int arr[100009];
 bool number_gen[32];

void count_ones( int number){
    int i=0;
    while(number > 0){
        one_counts[i] += number%2;
        number = number >> 1;
        i++;

    }
}
void delete_ones( int number){
    int i=0;
    while(number > 0){
        one_counts[i] -= number%2;
        number = number >> 1;
        i++;
        cout << number;
    }
}

int main()
{
    int N,Q;
    cin >> N;
    unsigned int arr[N];
    for(int i=0;i<N;i++){
        cin >> arr[i];
        count_ones(arr[i]);

    }
    cin >> Q;
    bool upit;
    int num;
    for(int q=0;q<Q;q++){
        cin >> upit;

        if(!upit){
            cin >> num;
            num--;
            for(int i=0;i<32;i++){
                if(((int)one_counts[i]-num)>0){
                    number_gen[i] = true;
                }
                else{number_gen[i] = false;}
            }
        num = 0;
        for(int i=0;i<32;i++){
            num += number_gen[i] == 1 ? power(i): 0;
        }
        }
        int index, K;
        if(upit){
            cin >> index >> K;
            index--;
            num = arr[index] ;
            delete_ones(num);
            arr[index] = K;
            count_ones(arr[index]);
        }
    }
    return 0;
}