#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500005;
int a[MAXN], b[MAXN], ans[MAXN];
set<pair<int, int> > tr[MAXN];
bool flag[MAXN];
int n, T;
void Add(int id) {
  int x = id;
  pair<int, int> p = {b[id], id};
  while (x <= n) {
    tr[x].insert(p);
    x += x & -x;
  }
  return;
}
void DFS(int u) {
  int x;
  flag[u] = true;
  if (b[u] != n + 1 && !flag[b[u]]) DFS(b[u]);
  x = a[u] - 1;
  while (x) {
    while (!tr[x].empty() && tr[x].rbegin()->first > u) {
      int t = tr[x].rbegin()->second;
      tr[x].erase(*(tr[x].rbegin()));
      if (!flag[t]) DFS(t);
    }
    x -= x & -x;
  }
  ans[u] = ++T;
  return;
}
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]), a[i] = (a[i] == -1 ? n + 1 : a[i]), b[a[i]] = i;
  for (int i = 1; i <= n; ++i) Add(i);
  for (int i = 1; i <= n; ++i)
    if (!flag[i]) DFS(i);
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}
