Add One

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

문제

Given nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n, you want to perform the following operation exactly n1n-1 times.

  • Choose two integers xx and yy in the sequence, remove them, and add a number with the value xyx\oplus y.

Since this alone is just too boring, you can additionally choose a number and add one to it at any moment. You must perform the add-one operation exactly once.

Eventually, only one number will be left in this sequence, and you need to maximize this remaining number. Print the maximum value of the remaining number.

입력

The first line of the input contains a single integer nn (1n1061 \le n \le 10^6).

The next line of the input contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (0a_i<2600 \le a\_i < 2^{60}).

출력

Output a single line containing a single integer: the maximum value of the remaining number.

힌트

In the first example, the optimal strategy is:

  • Choose 11 and 22: \[1,2,1,2]\[1,2,3]\[\mathbf{1}, \mathbf{2}, 1, 2] \to \[1, 2, \mathbf{3}]
  • Choose 11 and 22: \[1,2,3]\[3,3]\[\mathbf{1}, \mathbf{2}, 3] \to \[3, \mathbf{3}]
  • Add one to the number 33: \[3,3]\[3,4]\[\mathbf{3}, 3] \to \[3, \mathbf{4}]
  • Choose 33 and 44: \[3,4]\[7]\[\mathbf{3}, \mathbf{4}] \to \[\mathbf{7}]