import sys
input = sys.stdin.readline

n = int(input())                            # 돌덩어리 무리 갯수

group = [i for i in range(1, n+1)]          # 돌덩어리 무리 (키작은 순)
limitList = list(map(int, input().split())) # 시야 점수 제한 크기 리스트

result = []
for i in limitList:
    if i < 0:                               # 시야 점수가 0보다 작은 경우
        result.append(group.pop(0))         # 작은놈 부터 배치
    else:                                   # 클 경우
        result.append(group.pop())          # 큰 놈부터 배치

if limitList[n-1] < 0:                      # 마지막 무리는 시야 점수 10^9임 ㅅㄱ
    print(-1)
else:
    for i in result:                        # 배치한거 출력
        print(i, end=' ')