#include <bits/stdc++.h>

using namespace std;

#define MAXN 100010
#define MAXM 32

long long n,q;
long long a[MAXN],b[MAXN];
long long st2[MAXM];
map<long long,long long> bitovi;

int main()
{
    ios_base::sync_with_stdio(false);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    st2[0]=1;
    for (long long i=1;i<MAXM;i++) st2[i]=st2[i-1]*2;
    cin>>n;
    for (long long i=1;i<=n;i++) cin>>a[i];
    for (long long i=1;i<=n;i++)
    {
        long long x=a[i];
        for (long long j=MAXM-1;j>=0;j--)
        {
            if (x<st2[j]) continue;
            if (bitovi.find(j)==bitovi.end()) bitovi[j]=1;
            else bitovi[j]++;
            x-=st2[j];
        }
    }
    for (long long j=0;j<MAXM;j++)
    {
        if (bitovi.find(j)==bitovi.end()) continue;
        long long poz=bitovi[j];b[poz]=b[poz]|st2[j];
    }
    for (long long i=n-1;i>=1;i--) b[i]=b[i]|b[i+1];
    cin>>q;
    for (long long z=0;z<q;z++)
    {
        long long t;cin>>t;
        if (t==0)
        {
            long long k;cin>>k;
            cout<<b[k]<<endl;
        }
        else
        {
            long long k,x;cin>>k>>x;
            for (long long i=1;i<=n;i++) b[i]=0;
            long long tren=a[k];
            for (long long j=MAXM-1;j>=0;j--)
            {
                if (tren<st2[j]) continue;
                bitovi[j]--;tren-=st2[j];
            }
            a[k]=x;tren=x;
            for (long long j=MAXM-1;j>=0;j--)
            {
                if (tren<st2[j]) continue;
                if (bitovi.find(j)==bitovi.end()) bitovi[j]=1;
                else bitovi[j]++;
                tren-=st2[j];
            }
            for (long long j=0;j<MAXM;j++)
            {
                if (bitovi.find(j)==bitovi.end()) continue;
                long long poz=bitovi[j];b[poz]=b[poz]|st2[j];
            }
            for (long long i=n-1;i>=1;i--) b[i]=b[i]|b[i+1];
        }
    }
}