n = int(input()) a = list(map(int,input().split())) buf = a[0] for i in range(1,n): buf |= a[i] cnt = 0 while (1 << cnt) & buf: cnt += 1 print(1 << cnt)