N, *A = map(int, open(0).read().split()) x = 0 for a in A: x |= a print(1 << x.bit_length())