N = int(input()) A = list(map(int, input().split())) cnt = 0 for a in A: cnt += format(a, 'b').count('1') ans = 0 for i in range(15,15-min(16,cnt),-1): ans+=2**i print(ans)