using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var a = NList; for (var i = 0; i < 63; ++i) { var x = 1L << i; var flg = true; foreach (var ai in a) if (x + ai != (x ^ ai)) flg = false; if (flg) { WriteLine(x); return; } } } }