As a modern alchemy student, you are taking an exam in Alchembit, a hybrid between alchemy and modern technology. In the exam, you are given $N$ potions (numbered from $1$ to $N$) where potion $i$ has a potency of an integer $A_i$. You start the exam with a score of $0$.
You can increase your score by doing the following procedure.
For example, if you have $5$ potions with potencies $A = [19, 12, 10, 20, 23]$, and you choose interval $[2, 3]$, then your score will be increased by $12 \,\&\, 10 = 8$. Then, potions $2$ and $3$ are fused into a new potion with a potency of $12 \,\&\, 10 = 8$. After the renumbering procedure (step 4), A becomes $[19, 8, 20, 23]$.
You can perform the above procedure until there is only one potion left. Determine the maximum score that you can achieve.
The first line consists of an integer $N$ ($2 ≤ N ≤ 100\, 000$).
The second line consists of $N$ integers $A_i$ ($0 ≤ A_i < 2^{30}$).
Output a single integer representing the maximum score that you can get.