#include <bits/stdc++.h>
using namespace std;
int N, Q, T, K, X;
int A[100096];
int BITS[32];
inline void Add(int X)
{
    int counter = 0;
    while(X)
    {
        BITS[counter] += X & 1;
        X >>= 1;
        counter++;
    }
    return;
}
inline void Remove(int X)
{
    int counter = 0;
    while(X)
    {
        BITS[counter] -= X & 1;
        X >>= 1;
        counter++;
    }
    return;
    return;
}
inline int Get(int K)
{
    int RET = 0;
    for(int i = 0; i <= 30; i++) RET += (K <= BITS[i]) * (1 << i);
    return RET;
}
int main()
{
    scanf("%d", &N);
    for(int i = 1; i <= N; i++)
    {
        scanf("%d", &A[i]);
        Add(A[i]);
    }
    scanf("%d", &Q);
    while(Q--)
    {
        scanf("%d", &T);
        if(!T)
        {
            scanf("%d", &K);
            printf("%d\n", Get(K));
        }
        else
        {
            scanf("%d %d", &K, &X);
            Remove(A[K]);
            A[K] = X;
            Add(X);
        }
    }

    return 0;
}