atcoder#ARC092B. [ABC091D] Two Sequences

[ABC091D] Two Sequences

Score : 500500 points

Problem Statement

You are given two integer sequences, each of length NN: a1,...,aNa_1, ..., a_N and b1,...,bNb_1, ..., b_N.

There are N2N^2 ways to choose two integers ii and jj such that 1i,jN1 \leq i, j \leq N. For each of these N2N^2 pairs, we will compute ai+bja_i + b_j and write it on a sheet of paper. That is, we will write N2N^2 integers in total.

Compute the XOR of these N2N^2 integers.

Definition of XOR

The XOR of integers c1,c2,...,cmc_1, c_2, ..., c_m is defined as follows:

  • Let the XOR be XX. In the binary representation of XX, the digit in the 2k2^k's place (0k0 \leq k; kk is an integer) is 11 if there are an odd number of integers among c1,c2,...cmc_1, c_2, ...c_m whose binary representation has 11 in the 2k2^k's place, and 00 if that number is even.

For example, let us compute the XOR of 33 and 55. The binary representation of 33 is 011011, and the binary representation of 55 is 101101, thus the XOR has the binary representation 110110, that is, the XOR is 66.

Constraints

  • All input values are integers.
  • 1N200,0001 \leq N \leq 200,000
  • 0ai,bi<2280 \leq a_i, b_i < 2^{28}

Input

Input is given from Standard Input in the following format:

NN

a1a_1 a2a_2 ...... aNa_N

b1b_1 b2b_2 ...... bNb_N

Output

Print the result of the computation.

2
1 2
3 4
2

On the sheet, the following four integers will be written: 4(1+3),5(1+4),5(2+3)4(1+3), 5(1+4), 5(2+3) and 6(2+4)6(2+4).

6
4 6 0 0 3 3
0 5 6 5 0 3
8
5
1 2 3 4 5
1 2 3 4 5
2
1
0
0
0