N=int(input()) D=list(map(int,input().split())) A=[] B=[] DP=[-1]*(1<0: DP[i|(1<