n = int(input()) s = list(map(int,input().split())) class BIT(): def __init__(self,n,calc,mono): self.size = (1 << (n-1).bit_length()) + 1 self.arr = [mono] * self.size self.calc = calc self.mono = mono def update(self,i,val): while i < self.size: self.arr[i] = self.calc([self.arr[i],val]) i += -i & i def query(self,i): res = self.mono while i > 0: res = self.calc([res,self.arr[i]]) i -= -i & i return res bit = BIT(n+1,sum,0) cnt = 0 for i in range(n): cnt += bit.query(s[-(i+1)]) bit.update(s[-(i+1)]+1,1) if cnt & 1: print(-1) else: print(1)