

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
長さ の非負整数列 が与えられます。この整数列に対して以下の操作を 回行って長さ の整数列を得ることを考えます。
- を の長さとする。はじめに 内の要素を好きなように並び替える。 その後、 を長さ の非負整数列 に置き換える
ただしここで、 はビット単位 演算を表します。
回の操作後に得られる長さ の整数列が含む項の値を としたとき、 として考えられる値の最大値を求めてください。
ビット単位 演算とは
非負整数 のビット単位 、 は、以下のように定義されます。
- を二進表記した際の () の位の数は、 を二進表記した際の の位の数のうち一方のみが であれば 、そうでなければ である。
一般に 個の非負整数 のビット単位 は と定義され、これは の順番によらないことが証明できます。
制約
- 入力される値はすべて整数
入力
入力は以下の形式で標準入力から与えられる。
出力
答えを出力せよ。
入力例 1Copy
4 1 2 3 4
出力例 1Copy
7
以下のような 回の操作により を とできます。
- 回目の操作にて、 を と並び替える。 は に置き換わる。
- 回目の操作にて、 を と並び替える。 は に置き換わる。
- 回目の操作にて、 を と並び替える。 は に置き換わる。
入力例 2Copy
13 451745518671773958 43800508384422957 153019271028231120 577708532586013562 133532134450358663 619750463276496276 615201966367277237 943395749975730789 813856754125382728 705285621476908966 912241698686715427 951219919930656543 124032597374298654
出力例 2Copy
1152905479775702586
Score: points
Problem Statement
You are given a sequence of non-negative integers . Consider performing the following operation times on this sequence to obtain a sequence of length :
- Let be the length of . First, rearrange the elements in in any order you like. Then, replace with a sequence of non-negative integers .
Here, represents the bitwise operation.
Let be the value of the term contained in the sequence of length obtained after operations. Find the maximum possible value of .
What is the bitwise operation?
The bitwise of two non-negative integers and , denoted as , is defined as follows:
- In the binary representation of , the digit at the () position is if the digit at the position is in or but not both, and otherwise.
In general, the bitwise of non-negative integers is defined as , and it can be proved that this does not depend on the order of .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1Copy
4 1 2 3 4
Sample Output 1Copy
7
The sequence can be transformed into by the following three operations:
- In the first operation, rearrange to . is replaced with .
- In the second operation, rearrange to . is replaced with .
- In the third operation, rearrange to . is replaced with .
Sample Input 2Copy
13 451745518671773958 43800508384422957 153019271028231120 577708532586013562 133532134450358663 619750463276496276 615201966367277237 943395749975730789 813856754125382728 705285621476908966 912241698686715427 951219919930656543 124032597374298654
Sample Output 2Copy
1152905479775702586