ll@N,@A[N];wt(max[i,0,N](min[j,i+1,N@A[j-1]+A[i+1]^A[i]+A[j]$N](j)-i));