_,S=input(),list(map(lambda k:int(k),(input()).split(" "))) print(-1 if sum(1 for i, k in enumerate(S) for j, l in enumerate(S) if i < j and k < l) % 2 else 1)