H. for-for-for-for
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

After a tiring practical test at OOP, Rares is faced with a new challenge. He has to solve the following problem, otherwise he will fail the Programming class.

Let $$$v$$$ be an array of $$$n$$$ non-negative integers. Find the maximum value of ($$$v_i$$$ $$$\oplus$$$ $$$v_j$$$) $$$\times$$$ ($$$v_k$$$ + $$$v_l$$$), where $$$1$$$ $$$\le$$$ $$$i \lt j \lt k \lt l$$$ $$$\le$$$ $$$n$$$. Here $$$\oplus$$$ represents the bitwise xor operation.

Help Rares save his GPA!

Input

The first line of the input contains $$$n$$$ ($$$4$$$ $$$\le$$$ $$$n$$$ $$$\le$$$ $$$200000$$$), the size of the given array.

The next line contains $$$n$$$ non-negative integers $$$v_1$$$, $$$v_2$$$, ..., $$$v_n$$$ ($$$0$$$ $$$\le$$$ $$$v_i$$$ $$$\le$$$ $$$2^{30}-1$$$).

Output

Output a single number, the maximum value of ($$$v_i$$$ $$$\oplus$$$ $$$v_j$$$) $$$\times$$$ ($$$v_k$$$ + $$$v_l$$$), where $$$1$$$ $$$\le$$$ $$$i \lt j \lt k \lt l$$$ $$$\le$$$ $$$n$$$.

Scoring
  • For $$$20$$$ points, it is guaranteed that $$$n$$$ $$$\le$$$ $$$200$$$
  • For another $$$20$$$ points, it is guaranteed that $$$n$$$ $$$\le$$$ $$$2000$$$
  • For the last $$$60$$$ points, we have $$$n \leq 200000$$$
Example
Input
6
12 42 2 0 145 7
Output
6384
Note

Rares chooses $$$i=2$$$, $$$j=4$$$, $$$k=5$$$, $$$l=6$$$. The value is ($$$42$$$ $$$\oplus$$$ $$$0$$$) $$$\times$$$ ($$$145$$$ + $$$7$$$) = $$$6384$$$.