#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int mod = 1000000007;
const int inf = 2012345678;
const long long infl = 9012345678901234567;
const double pi = 3.1415926535897932384626433832795;
const int N = 500010;
set<pair<int, int> > tr[N];
int a[N], chk[N], res[N], clk, b[N];
void upd(pair<int, int> x, int i, int n) {
  while (i <= n) {
    tr[i].insert(x);
    i += i & (-i);
  }
}
int n;
void dfs(int u) {
  chk[u] = 1;
  if (a[u] != inf)
    if (!chk[a[u]]) dfs(a[u]);
  int x = b[u];
  x--;
  if (b[u] == -1) x = n;
  while (x) {
    while (1) {
      auto it = tr[x].lower_bound(pair<int, int>(u, 0));
      if (it != tr[x].end()) {
        int v = it->second;
        tr[x].erase(it);
        if (!chk[v]) dfs(v);
      } else
        break;
    }
    x -= x & (-x);
  }
  res[u] = clk++;
}
int main() {
  freopen("input.txt", "r", stdin);
  scanf("%d", &(n));
  for (int i = 1; i <= (n); i++) scanf("%d", &(a[i]));
  for (int i = 1; i <= (n); i++) b[i] = -1;
  for (int i = 1; i <= (n); i++) {
    if (a[i] == -1)
      a[i] = inf;
    else
      b[a[i]] = i;
    upd(pair<int, int>(a[i], i), i, n);
  }
  for (int i = 1; i <= (n); i++)
    if (!chk[i]) dfs(i);
  for (int i = 1; i <= (n); i++) printf("%d ", n - res[i]);
  puts("");
  return 0;
}
