Codeforces Round 613 (Div. 2)
D
Dr. Evil Underscores
Codeforces
1900
原题
← CE →
翻译中…

Today, as a friendship gift, Bakry gave Badawy $n$ integers $a_1, a_2, \dots, a_n$ and challenged him to choose an integer $X$ such that the value $\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$ is minimum possible, where $\oplus$ denotes the bitwise XOR operation.

翻译中…

As always, Badawy is too lazy, so you decided to help him and find the minimum possible value of $\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$.

翻译中…

Input

翻译中…

The first line contains integer $n$ ($1\le n \le 10^5$).

翻译中…

The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 2^{30}-1$).

翻译中…

Output

翻译中…

Print one integer — the minimum possible value of $\underset{1 \leq i \leq n}{\max} (a_i \oplus X)$.

翻译中…

Note

翻译中…

In the first sample, we can choose $X = 3$.

翻译中…

In the second sample, we can choose $X = 5$.

翻译中…

样例

Input #1
3
1 2 3
Output #1
2
InputCopy OutputCopy
Input #2
2
1 5
Output #2
4
InputCopy OutputCopy
题目信息
题号
1285D
时间限制
1 s
内存限制
256 MB
标签
位运算
暴力
DFS 及类似
分治
动态规划
贪心
字符串
树

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。