#include <bits/stdc++.h>
using namespace std;
struct edge {
  int up, down;
};
long long n, x, now = 1;
vector<char> used;
vector<int> code;
vector<int> versa;
vector<pair<int, int> > t;
vector<int> ans;
void build(int v, int tl, int tr) {
  if (tl == tr)
    t[v] = {versa[tl], tl};
  else {
    int tm = (tl + tr) / 2;
    build(v * 2, tl, tm);
    build(v * 2 + 1, tm + 1, tr);
    t[v] = max(t[v * 2], t[v * 2 + 1]);
  }
}
void update(int v, int tar, int tl, int tr) {
  if (tl == tr)
    t[v].first = 0;
  else {
    int tm = (tl + tr) / 2;
    if (tar <= tm)
      update(v * 2, tar, tl, tm);
    else
      update(v * 2 + 1, tar, tm + 1, tr);
    t[v] = max(t[v * 2], t[v * 2 + 1]);
  }
}
pair<int, int> do_search(int v, int l, int r, int tl, int tr) {
  if (l > r) return {0, 0};
  if (l == tl && r == tr)
    return t[v];
  else {
    int tm = (tr + tl) / 2;
    return max(do_search(v * 2, l, min(r, tm), tl, tm),
               do_search(v * 2 + 1, max(tm + 1, l), r, tm + 1, tr));
  }
}
void read() {
  cin >> n;
  ans.resize(n + 1, 0);
  code.resize(n + 1);
  t.resize((n + 1) * 4);
  versa.resize(n + 1, n + 1);
  used.resize(n + 1, false);
  for (int i = 1; i <= n; i++) {
    cin >> x;
    code[i] = x;
    if (x != -1) versa[x] = i;
  }
  for (int i = 1; i <= n; i++)
    if (code[i] == -1) code[i] = n + 1;
}
void topology_sort(int v) {
  used[v] = true;
  update(1, v, 1, n);
  if (versa[v] != n + 1 && !used[versa[v]]) topology_sort(versa[v]);
  while (1 < 2) {
    pair<int, int> cur;
    cur = do_search(1, 1, code[v] - 1, 1, n);
    if (v < cur.first)
      topology_sort(cur.second);
    else
      break;
  }
  ans[v] = now;
  now++;
}
void filling() {
  for (int i = 1; i <= n; i++) {
    if (!used[i]) topology_sort(i);
  }
}
int main() {
  read();
  build(1, 1, n);
  filling();
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
