LearnPy Hub
← Arena
IntermediateRating 1400

Largest AND of a Pair

Print the largest value of aᵢ AND aⱼ over all pairs i < j. n can be 10⁵.

Input

n, then n non-negative integers below 2³⁰.

Output

One integer.

Sample 1

Input
4
4 8 12 16
Output
8

Sample 2

Input
4
4 8 16 2
Output
0
solution.py
Output appears here
Largest AND of a Pair · Python Arena problem · LearnPy Hub