def refine(number, size):
    while len(bin(number)) != size:
        number = number << 1

    return number

def unrefine(number):
    while not number & 1:
        number = number >> 1

    return number

def action(a):
    if len(a) != 1:
        b = a
        best = max(map(lambda x: len(bin(x)), a))
        length = len(b) - 1
        a = sorted(list(set([refine(x, best) for x in a])))
        a.append(min(map(lambda x: a[x] ^ a[x + 1], range(length))))
        a.append(min(map(lambda x: b[x] ^ b[x + 1], range(length))))

        return min([unrefine(x) for x in a])
    return unrefine(a[0])

N = int(input())
a = list(map(int, input().split()))
Q = int(input())

for x in range(Q):
    j = tuple(map(int, input().split()))

    if j[0] == 1:
        a[j[1] - 1] = j[2]
    else:
        print(action(list(set(a[j[1] - 1:j[2]]))))