n=int(input()) a=[*map(int,input().split())] for i in range(30)[::-1]: l=r=0 while r