#include <bits/stdc++.h>
using namespace std;
int n, dfn[500010], x = 0, c[500010], a[500010];
bool vis[500010];
struct node {
  int pos, c;
  node operator+(const node &b) const { return c > b.c ? *this : b; }
} tr[2000010];
void add(int a, int l, int r, int t, int c) {
  if (l == r) {
    tr[t] = (node){a, c};
    return;
  }
  int mid = (l + r) >> 1;
  if (a <= mid)
    add(a, l, mid, t << 1, c);
  else
    add(a, mid + 1, r, t << 1 | 1, c);
  tr[t] = tr[t << 1] + tr[t << 1 | 1];
}
node find(int ll, int rr, int l, int r, int t) {
  if (ll <= l && r <= rr) return tr[t];
  int mid = (l + r) >> 1;
  if (rr <= mid) return find(ll, rr, l, mid, t << 1);
  if (mid < ll) return find(ll, rr, mid + 1, r, t << 1 | 1);
  return find(ll, rr, l, mid, t << 1) + find(ll, rr, mid + 1, r, t << 1 | 1);
}
void dfs(int u) {
  vis[u] = true, add(u, 1, n, 1, 0);
  if (c[u] <= n && !vis[c[u]]) dfs(c[u]);
  if (a[u] > 1)
    while (true) {
      node v = find(1, a[u] - 1, 1, n, 1);
      if (v.c > u)
        dfs(v.pos);
      else
        break;
    }
  dfn[u] = ++x;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] < 0) a[i] = n + 1;
    c[a[i]] = i;
  }
  for (int i = 1; i <= n; i++)
    if (!c[i]) c[i] = n + 1;
  for (int i = 1; i <= n; i++) add(i, 1, n, 1, c[i]);
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs(i);
  for (int i = 1; i <= n; i++) printf("%d ", dfn[i]);
}
