Notebook

아직 제출이 없습니다시간 제한1초메모리 제한128 MB

문제

Ivan is writing down numbers in his notebook. In the beginning he has a set of integers SS written down. Afterwards, he may write down new numbers in his notebook, by using the following operations:

  • If he has the number xx written, he may write down 2x2x.
  • If he has the number xx written, and xx is divisible by 22, he may write down x2\frac{x}{2}.
  • If he has the distinct numbers xx and yy written, he may write down x xor yx \text{ xor } y.

Denote by f(S)f(S) the minimal number Ivan can write down in his notebook for the starting set SS.

You are given an array of length NN and QQ queries where you have to perfortm one of the following operations:

  • Change the value of the a\[x]a\[x] to yy.
  • Find the value of f(a\[L],a\[L+1],,a\[R])f(\\{a\[L],a\[L+1],\cdots,a\[R]\\}).

입력

In the first line of input is the numbers NN (N100000N\leq 100000): the length of the array.

In the second line of input is NN integers a\[1],a\[2],,a\[N]a\[1],a\[2],\cdots,a\[N] (0\<a\[i]<2620\<a\[i]<2^{62}), the elements of aa.

In the thirst line of input is the number QQ (Q100000Q\leq 100000): the number of queries.

The following QQ lines describe the queires. A query can either be of the format "11 xx yy" meaning set a\[x]a\[x] (1xN1\leq x\leq N) to yy (0\<y<2620\<y<2^{62}), or of the format "22 ll rr" meaning find the value of  f(a\[L],a\[L+1],,a\[R])f(\\{a\[L],a\[L+1],\cdots,a\[R]\\}) (1LRN1\leq L\leq R\leq N).

출력

For every query of type two print the value of f(a\[L],a\[L+1],,a\[R])f(\\{a\[L],a\[L+1],\cdots,a\[R]\\}) in a single line.