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.
#include <bits/stdc++.h>
using namespace std;
long long readi() {
  long long input = 0;
  char c = ' ';
  while (c < '-') {
    c = getchar();
  }
  bool negative = false;
  if (c == '-') {
    negative = true;
    c = getchar();
  }
  while (c >= '0') {
    input = 10 * input + (c - '0');
    c = getchar();
  }
  if (negative) {
    input = -input;
  }
  return input;
}
string reads() {
  string input = "";
  char c = ' ';
  while (c <= ' ') {
    c = getchar();
  }
  while (c > ' ') {
    input += c;
    c = getchar();
  }
  return input;
}
void printi(long long output) {
  if (output == 0) {
    putchar('0');
    return;
  }
  if (output < 0) {
    putchar('-');
    output = -output;
  }
  vector<char> vout;
  while (output) {
    vout.push_back((output % 10) + '0');
    output /= 10;
  }
  for (int i = vout.size() - 1; i >= 0; i--) {
    putchar(vout[i]);
  }
  return;
}
void prints(string output) {
  for (int i = 0; i < output.length(); i++) {
    putchar(output[i]);
  }
  return;
}
int N;
int arr[500010];
int rev[500010];
int ans[500010];
bool seen[500010];
int tree[4 * 500010];
int best[4 * 500010];
vector<int> edge[500010];
vector<int> topo;
void update(int w, int L, int R, int a, int val) {
  if (a < L || a > R) {
    return;
  }
  if (L == R) {
    tree[w] = val;
    best[w] = L;
    return;
  }
  int mid = (L + R) / 2;
  update(2 * w, L, mid, a, val);
  update(2 * w + 1, mid + 1, R, a, val);
  if (tree[2 * w] > tree[2 * w + 1]) {
    best[w] = best[2 * w];
  } else {
    best[w] = best[2 * w + 1];
  }
  tree[w] = max(tree[2 * w], tree[2 * w + 1]);
  return;
}
pair<int, int> query(int w, int L, int R, int a, int b) {
  if (b < L || a > R) {
    return make_pair(-1000000861, -1);
  }
  if (a <= L && R <= b) {
    return make_pair(tree[w], best[w]);
  }
  int mid = (L + R) / 2;
  pair<int, int> ltq = query(2 * w, L, mid, a, b);
  pair<int, int> rtq = query(2 * w + 1, mid + 1, R, a, b);
  if (ltq.first > rtq.first) {
    return ltq;
  } else {
    return rtq;
  }
}
void toposort(int u) {
  seen[u] = true;
  int v = arr[u];
  if (v != N && !seen[v]) {
    toposort(v);
    update(1, 0, N - 1, v, 0);
  }
  if (rev[u] >= 1) {
    pair<int, int> q = query(1, 0, N - 1, 0, rev[u] - 1);
    while (q.first > u) {
      v = q.second;
      if (!seen[v]) {
        toposort(v);
      }
      update(1, 0, N - 1, v, 0);
      q = query(1, 0, N - 1, 0, rev[u] - 1);
    }
  }
  topo.push_back(u);
}
int32_t main() {
  cout << fixed << setprecision(10);
  ios_base::sync_with_stdio(false);
  if (fopen("cf798e.in", "r")) {
    freopen("cf798e.in", "r", stdin);
    freopen("cf798e.out", "w", stdout);
  }
  cin >> N;
  for (int i = 0; i < N; i++) {
    rev[i] = N;
  }
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
    arr[i]--;
    if (arr[i] == -2) {
      arr[i] = N;
    }
    rev[arr[i]] = i;
  }
  for (int i = 0; i < N; i++) {
    update(1, 0, N - 1, i, arr[i]);
  }
  for (int i = 0; i < N; i++) {
    if (!seen[i]) {
      toposort(i);
    }
  }
  reverse(topo.begin(), topo.end());
  for (int i = 0; i < topo.size(); i++) {
    ans[topo[i]] = i + 1;
  }
  for (int i = 0; i < N; i++) {
    cout << ans[i] << '\n';
  }
  return 0;
}
