11770 - G - XOR   

Description

Writer: jjjjj19980806       Description: pclightyear        Difficulty: ★★★

Given n numbers, you need to find a number k such that SUM is minimum,

where we define SUM = ( a1 ^ k ) + ( a2 ^ k ) + ... + ( an ^ k )

(^ stands for the "xor" bitwise operation of the two operand)

Input

The first line contains an integer n, representing the number of numbers.

The next line contains n integers ai, representing each given number.

It is guaranteed that:

  • ≤ 105
  • 0 ≤ ai ≤ 106
  • All numbers ( ai and k ) are unsigned numbers

Output

Please output the value of SUM.

Note SUM may exceed INT.

Sample Input  Download

Sample Output  Download

Tags

0.0 0..0 0...0 0....0 歐拉歐拉 對不起我亂玩 我是小波 小波可撥 我是小波的大波 大小波 大大..啊..小波 0......0 o



Discuss