#include <bits/stdc++.h>

using namespace std;
#define int long long
signed  main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    int a[n];
    int njv = -1;
    for(int i =0; i< n; i++)
    {
        cin >> a[i];
        njv = max(njv, a[i]);
    }
    int g = 0;
    int p = 1;
    while(p <= njv)
    {
        p*=2;
        g++;
    }
    int b[n+1][g];
    for(int i = 0; i < g; i++)
    {
        b[n][i] = 0;
    }
    for(int i = 0; i < n ;i++)
    {
          int c = a[i];
        for(int j = 0; j < g;j++)
        {

            if(pow(2, g-j-1) <= c)
            {
                b[i][j]= 1;
                c -= pow(2, g-j-1);
                b[n][j] ++;
            }
            else
            {
                b[i][j]= 0;
            }
             //cout << b[i][j] << " ";
        }
        //cout << endl;
    }
    for(int i = 0; i < g; i++)
    {
        //cout << b[n][i] << " " ;
    }
   // cout << endl;
     int q;
     cin >> q;
     int soli[q];
     for(int i = 0; i < q; i++)
     {
         int t, k, x;
         cin >> t >>  k;
         if(t == 0)
         {
             int sol = 0;
             for(int j = 0; j< g; j++)
             {
                 if(b[n][j] >= k)
                 {
                     sol += pow(2, g-1-j);
                 }
             }
             soli[i]= sol;
         }
         else if(t == 1)
         {
             cin >> x;

             for(int j = 0; j < g;j++)
        {

            if(pow(2, g-j-1) <= x)
            {

                x -= pow(2, g-j-1);
                b[n][j] += 1-b[k-1][j];
            }
            else
            {
                b[n][j] -= b[k-1][j];
            }

         }
         soli[i] = -1;
     }
     }
     for(int i = 0; i < q; i++)
     {
        if(soli[i]!= -1) cout << soli[i] << endl;
     }
    /*int x = 0;
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        if(a[i] == 1)
        {
            x++;
        }
    }
    int q;
    cin >> q;
    for(int i = 0; i<q;i++)
    {
        int t, k, y;
        cin >> t >> k ;
        if(t == 1){
            cin >> y;
            x += (y-a[k-1]);
            a[k-1] = y;
        }

        else if(t == 0)
        {
            if(k <= x)
            {
                cout << 1;
            }
            else
            {
                cout << 0;
            }
        }
    }
*/
    return 0;
}