from itertools import combinations N = int(input()) A = list(map(int,input().split())) B = list(range(N)) def dfs(i,v): global B for u in combinations(B,3): x = A[u[0]] y = A[u[1]] z = A[u[2]] if x!=y and y!=z and z!=x and (y==max(x,y,z) or y==min(x,y,z)): if len(B)-3<3: return i,u B.remove(u[0]) B.remove(u[1]) B.remove(u[2]) i1,u1 = dfs(1-i,u) if i1==i: B += u B = sorted(B) return i,u B += u B = sorted(B) else:continue return 1-i,v i,u = dfs(0,[]) if i==0: print(*u) else: print(-1)