#include <bits/stdc++.h>
using namespace std;
int ql, qr, pos;
pair<int, int> Max[500010 * 4];
int a[500010], b[500010], vis[500010], ans[500010];
int n;
vector<int> topo;
void build(int l, int r, int o) {
  if (l == r) {
    Max[o] = make_pair(b[l], l);
    return;
  }
  int mid = l + (r - l) / 2;
  build(l, mid, o * 2);
  build(mid + 1, r, o * 2 + 1);
  Max[o] = max(Max[o * 2], Max[o * 2 + 1]);
}
void update(int l, int r, int o) {
  if (l == r) {
    Max[o] = make_pair(0, 0);
    return;
  }
  int mid = l + (r - l) / 2;
  if (pos <= mid)
    update(l, mid, o * 2);
  else
    update(mid + 1, r, o * 2 + 1);
  Max[o] = max(Max[o * 2], Max[o * 2 + 1]);
}
pair<int, int> query(int l, int r, int o) {
  if (qr == 0) return make_pair(0, 0);
  if (ql <= l && qr >= r) {
    return Max[o];
  }
  int mid = l + (r - l) / 2;
  pair<int, int> pr = make_pair(0, 0);
  if (ql <= mid) pr = max(pr, query(l, mid, o * 2));
  if (qr > mid) pr = max(pr, query(mid + 1, r, o * 2 + 1));
  return pr;
}
void dfs(int u) {
  pos = u;
  update(1, n, 1);
  vis[u] = true;
  if (b[u] != n + 1 && vis[b[u]] == 0) dfs(b[u]);
  while (true) {
    ql = 1, qr = a[u] - 1;
    pair<int, int> pr = query(1, n, 1);
    if (pr.first > u)
      dfs(pr.second);
    else
      break;
  }
  topo.push_back(u);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) b[i] = n + 1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == -1) {
      a[i] = n + 1;
    } else {
      b[a[i]] = i;
    }
  }
  build(1, n, 1);
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0) dfs(i);
  }
  int cnt = 0;
  for (int i = 0; i < topo.size(); i++) {
    ans[topo[i]] = ++cnt;
  }
  for (int i = 1; i <= n; i++) {
    if (i > 1) putchar(' ');
    printf("%d", ans[i]);
  }
  puts("");
  return 0;
}
