n = int(input()) a = [int(i) for i in input().split()] keta = [0]*n for i in range(n): tmp = format(a[i], '0'+str(61)+'b') keta[i] = tmp for i in range(61): for j in range(n): #print(j) if keta[j][60-i] == "1": break if j == n-1: #print(i) print(2**i) exit()