from itertools import combinations def is_kadomatu(a: int, b: int, c: int) -> bool: if a == b or b == c or c == a: return False if a < b < c: return False if a > b > c: return False return True # ゲームに勝つか。先手(turn=1) def f(turn, used) -> bool: res = False for a, b, c in combinations(range(N), 3): if used[a] or used[b] or used[c]: continue if not is_kadomatu(A[a], A[b], A[c]): continue used[a] = used[b] = used[c] = turn res |= not f(turn+1, used) if res and turn == 1: return True used[a] = used[b] = used[c] = 0 return res N = int(input()) A = list(map(int, input().split())) used = [0] * N iswin = f(1, used) if not iswin: print(-1) exit() ans = [i for i in range(N) if used[i] == 1] print(*ans)