_,S=input(),(input()).split(" ") print(1 if sum(len([p for p in S[:i] if p < int(k)]) for i, k in enumerate(S)) % 2 else -1)