M is alone and he has an array \(a_1, a_2, ..., a_n\). M wants to choose two integers \(i, j\) such that \(i \neq j, 1 \leq i, j \leq n\) and the value \(a_i \& a_j\)(bitwise AND) is maximum.
What is the maximum value M can get?
Input
First line contains only \(n\), legnth of array.
Second line contains the array elements \(a_1, a_2, ..., a_n\)separated by space.
\(1 \leq n \leq 3 \times 10^5\)
\(1 \leq a_i \leq 10^9\)
Output
The only line of output contains an integer, maximum value value that M can get.
M can choose \(a_1 = 3\) and \(a_4 = 3\) with bitwise AND \(3\) which is maximum.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor