#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int neg = 1, num = 0;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') neg = -1;
  for (; isdigit(c); c = getchar()) num = (num << 1) + (num << 3) + c - '0';
  return neg * num;
}
int n, cnt, m, a[500010], b[500010], p[500010], q[500010];
bool vis[500010];
pair<int, int> t[500010 << 2];
inline void Build(int x, int l, int r) {
  if (l == r) {
    t[x] = make_pair(b[l], l);
    return;
  }
  int mid = l + r >> 1;
  Build(x << 1, l, mid);
  Build(x << 1 | 1, mid + 1, r);
  t[x] = max(t[x << 1], t[x << 1 | 1]);
}
pair<int, int> Query(int x, int l, int r, int L, int R) {
  if (l >= L && r <= R) return t[x];
  int mid = l + r >> 1;
  if (R <= mid) return Query(x << 1, l, mid, L, R);
  if (L > mid) return Query(x << 1 | 1, mid + 1, r, L, R);
  return max(Query(x << 1, l, mid, L, R), Query(x << 1 | 1, mid + 1, r, L, R));
}
inline void Del(int x, int l, int r, int p) {
  if (l == r) {
    t[x] = make_pair(0, l);
    return;
  }
  int mid = l + r >> 1;
  if (p <= mid)
    Del(x << 1, l, mid, p);
  else
    Del(x << 1 | 1, mid + 1, r, p);
  t[x] = max(t[x << 1], t[x << 1 | 1]);
}
inline void dfs(int u) {
  vis[u] = 1;
  Del(1, 1, n, u);
  if (b[u] != n + 1 && !vis[b[u]]) dfs(b[u]);
  if (a[u] > 1) {
    while (1) {
      pair<int, int> v = Query(1, 1, n, 1, a[u] - 1);
      if (v.first > u)
        dfs(v.second);
      else
        break;
    }
  }
  q[++m] = u;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++) {
    if (a[i] == -1)
      a[i] = n + 1;
    else
      b[a[i]] = i;
  }
  for (int i = 1; i <= n; i++)
    if (!b[i]) b[i] = n + 1;
  Build(1, 1, n);
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs(i);
  m = 0;
  for (int i = 1; i <= n; i++) p[q[i]] = ++m;
  for (int i = 1; i <= n; i++) printf("%d ", p[i]);
  return 0;
}
