#include <bits/stdc++.h>
const int maxn = 5e5 + 5;
using namespace std;
pair<int, int> mx[maxn * 4];
int a[maxn], b[maxn];
int que[maxn], clk, ans[maxn];
int n;
bool mark[maxn];
void Build(int id, int L, int R) {
  if (L == R)
    mx[id] = make_pair(b[L], L);
  else {
    int mid = L + R >> 1;
    Build(id << 1, L, mid);
    Build(id << 1 | 1, mid + 1, R);
    mx[id] = max(mx[id << 1], mx[id << 1 | 1]);
  }
}
void Mark(int id, int L, int R, int pos) {
  if (L == R)
    mx[id] = make_pair(0, L);
  else {
    int mid = L + R >> 1;
    if (pos <= mid)
      Mark(id << 1, L, mid, pos);
    else
      Mark(id << 1 | 1, mid + 1, R, pos);
    mx[id] = max(mx[id << 1], mx[id << 1 | 1]);
  }
}
pair<int, int> Query(int id, int L, int R, int l, int r) {
  if (l > r) return make_pair(0, 0);
  if (l <= L && R <= r)
    return mx[id];
  else {
    int mid = L + R >> 1;
    pair<int, int> ret = make_pair(0, 0);
    if (l <= mid) ret = max(ret, Query(id << 1, L, mid, l, r));
    if (mid < r) ret = max(ret, Query(id << 1 | 1, mid + 1, R, l, r));
    return ret;
  }
}
void dfs(int u) {
  Mark(1, 1, n, u);
  mark[u] = 1;
  if (b[u] != n + 1 && !mark[b[u]]) dfs(b[u]);
  for (;;) {
    pair<int, int> ret = Query(1, 1, n, 1, a[u] - 1);
    if (ret.first > u)
      dfs(ret.second);
    else
      break;
  }
  que[++clk] = u;
}
int main() {
  scanf("%d", &n);
  fill(b + 1, b + 1 + n, n + 1);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] != -1)
      b[a[i]] = i;
    else
      a[i] = n + 1;
  }
  Build(1, 1, n);
  for (int i = 1; i <= n; i++)
    if (!mark[i]) dfs(i);
  clk = 0;
  for (int i = 1; i <= n; i++) ans[que[i]] = ++clk;
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
