package yukicoder; import java.util.*; public class Q130 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long[] a = new long[n]; for (int i = 0; i < n; ++i) { a[i] = sc.nextLong(); } Arrays.sort(a); long ans = 0; for (int t = 0; t < 200; ++t) { for (long i = 32; i >= 0; --i) {// 3=1,1, if ((a[n - 1] & (1L << i)) > 0) { long[] tmp = Arrays.copyOf(a, n); long tmpMax = 0; for (int j = 0; j < n; ++j) { tmp[j] = a[j] ^ (1L << i); tmpMax = Math.max(tmpMax, tmp[j]); } if (tmpMax < a[n - 1]) { ans |= 1L << i; a = tmp; Arrays.sort(a); break; } } } } System.out.println(a[n - 1]); } }