| Baozii Cup 1 |
|---|
| Finished |
You are given an array $$$a$$$ of $$$n$$$ integers. Find:
$$$$$$\max_{1 \le i,j \le n} \gcd(a_i,a_j) + (a_i \oplus a_j)$$$$$$
where $$$\oplus$$$ denotes the bitwise XOR operation.
The first line of each test contains an integer $$$n$$$ ($$$1 \le n \le 5 \cdot 10 ^5$$$) — the length of $$$a$$$.
The second line contains $$$n$$$ integers $$$a_1,a_2,\ldots,a_n$$$ ($$$1 \le a_i \le 5 \cdot 10^5$$$) — the elements of $$$a$$$.
Output an integer representing the maximum value of the expression above.
31 2 3
4
59 9 3 8 2
13
| Name |
|---|


