#include #define rep(i, n) for (int i = 0; i < (n); ++i) using std::cin; using std::cout; using std::vector; using ll = long long; int main() { int n; cin >> n; vector a(n); rep(i, n) cin >> a[i]; ll s = 0; rep(i, n) s |= a[i]; rep(i, 60) { if ((s >> i & 1) == 0) { cout << (1ll << i) << '\n'; break; } } return 0; }