class Fenwick_Tree: def __init__(self, n): self.n = n self.data = [0] * n def add(self, p, x): p += 1 while p <= self.n: self.data[p - 1] += x p += p & -p def sum(self, l, r): '''範囲[l, r)(lからr-1まで)の総和を求める''' return self._sum(r) - self._sum(l) def _sum(self, r): '''範囲[0, r)(0からr-1まで)の総和を求める''' s = 0 while r > 0: s += self.data[r - 1] r -= r & -r return s n = int(input()) S = list(map(int, input().split())) FT = Fenwick_Tree(n + 1) ans = 0 for i in range(n): a = S[i] FT.add(a, 1) ans += FT.sum(a + 1, n + 1) if ans % 2 == 0: print(1) else: print(-1)