Problem: Mike has discovered a new way to encode permutations. If he has a permutation P = [p1, p2, ..., pn], he will encode it in the following way:

Denote by A = [a1, a2, ..., an] a sequence of length n which will represent the code of the permutation. For each i from 1 to n sequentially, he will choose the smallest unmarked j (1 ≤ j ≤ n) such that pi < pj and will assign to ai the number j (in other words he performs ai = j) and will mark j. If there is no such j, he'll assign to ai the number  - 1 (he performs ai = - 1). 

Mike forgot his original permutation but he remembers its code. Your task is simple: find any permutation such that its code is the same as the code of Mike's original permutation.

You may assume that there will always be at least one valid permutation.

Input

The first line contains single integer n (1 ≤ n ≤ 500 000) — length of permutation.

The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n or ai = - 1) — the code of Mike's permutation.

You may assume that all positive values from A are different.

Output

In first and only line print n numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — a permutation P which has the same code as the given one. Note that numbers in permutation are distinct.

Examples

Input

6
2 -1 1 5 -1 4


Output

2 6 1 4 5 3


Input

8
2 -1 4 -1 6 -1 8 -1


Output

1 8 2 7 3 6 4 5

Note

For the permutation from the first example:

i = 1, the smallest j is 2 because p2 = 6 > p1 = 2.

i = 2, there is no j because p2 = 6 is the greatest element in the permutation.

i = 3, the smallest j is 1 because p1 = 2 > p3 = 1.

i = 4, the smallest j is 5 (2 was already marked) because p5 = 5 > p4 = 4.

i = 5, there is no j because 2 is already marked.

i = 6, the smallest j is 4 because p4 = 4 > p6 = 3.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 19;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 1234567890123456789ll;
const double PI = acos(-1);
const double ERR = 1E-11;
pair<int, int> operator+(pair<int, int> a, pair<int, int> b) {
  return pair<int, int>(a.first + b.first, a.second + b.second);
}
pair<int, int> indt[1100000];
void update(int p, pair<int, int> v) {
  p += IT_MAX - 1;
  indt[p] = indt[p] + v;
  for (p /= 2; p; p /= 2) indt[p] = max(indt[2 * p], indt[2 * p + 1]);
}
pair<int, int> getmx(int p1, int p2) {
  p1 += IT_MAX - 1;
  p2 += IT_MAX - 1;
  pair<int, int> rv = pair<int, int>(-2 * INF, -INF);
  while (p1 <= p2) {
    if (p1 % 2 == 1) rv = max(rv, indt[p1++]);
    if (p2 % 2 == 0) rv = max(rv, indt[p2--]);
    p1 /= 2, p2 /= 2;
  }
  return rv;
}
int N;
int A[500050];
int B[500050];
int ans[500050];
bool dchk[500050];
vector<int> Vu;
void DFS(int n) {
  update(n, pair<int, int>(-INF * 2, 0));
  dchk[n] = true;
  while (1) {
    if (A[n] != N + 1 && !dchk[A[n]]) {
      DFS(A[n]);
      continue;
    }
    pair<int, int> rv = getmx(1, B[n] - 1);
    if (rv.first <= n) break;
    DFS(rv.second);
  }
  Vu.push_back(n);
}
int main() {
  int i;
  scanf("%d", &N);
  for (i = 1; i <= N; i++) B[i] = N + 1;
  for (i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
    if (A[i] == -1)
      A[i] = N + 1;
    else
      B[A[i]] = i;
  }
  for (i = 1; i <= N; i++) update(i, pair<int, int>(A[i], i));
  int v = N;
  for (i = 1; i <= N; i++) {
    if (dchk[i]) continue;
    DFS(i);
    for (auto it : Vu) ans[it] = v--;
    Vu.clear();
  }
  for (i = 1; i <= N; i++) printf("%d ", ans[i]);
  return !printf("\n");
}