N=int(input()) A=list(map(int,input().split())) ans = 0 if N>15: print(2**16-1) exit() ans = 0 def shift(x): return (x>>1) + (1<<15) * (x&1) dp = [[0]*16 for _ in range(N+1)] for i in range(N): a = A[i] for j in range(16): for k in range(16): x = dp[i][k] | a xx = x z=15 while z: z-=1 x = shift(x) if xx