N=int(input()) A=list(map(int,input().split())) import copy S=copy.deepcopy(A) for i in range(N-1,-1,-1): for j in range(19): if i & (1<