#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int)5e5 + 5;
const int INF = (int)1e9;
struct SegTree {
  int n;
  pair<int, int> tree[4 * MAXN];
  SegTree() {}
  void build(int node, int a, int b, int v[]) {
    if (a == b) {
      tree[node] = {v[a], a};
      return;
    }
    int mid = (a + b) / 2;
    build(node * 2, a, mid, v);
    build(node * 2 + 1, mid + 1, b, v);
    tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
  }
  void build(int v[], int n) {
    this->n = n;
    build(1, 1, n, v);
  }
  void update(int node, int a, int b, int pos, int val) {
    if (b < pos || a > pos) return;
    if (pos <= a && b <= pos) {
      tree[node] = {val, pos};
      return;
    }
    int mid = (a + b) / 2;
    update(node * 2, a, mid, pos, val);
    update(node * 2 + 1, mid + 1, b, pos, val);
    tree[node] = max(tree[node * 2], tree[node * 2 + 1]);
  }
  void update(int pos, int val) { update(1, 1, n, pos, val); }
  pair<int, int> query(int node, int a, int b, int l, int r) {
    if (b < l || a > r) return {0, 0};
    if (l <= a && b <= r) return tree[node];
    int mid = (a + b) / 2;
    pair<int, int> q1 = query(node * 2, a, mid, l, r);
    pair<int, int> q2 = query(node * 2 + 1, mid + 1, b, l, r);
    return max(q1, q2);
  }
  pair<int, int> query(int l, int r) { return query(1, 1, n, l, r); }
};
int a[MAXN];
int b[MAXN];
bool marked[MAXN];
int n;
SegTree tree;
int ans[MAXN];
vector<int> order;
void mark(int node) {
  marked[node] = true;
  tree.update(node, 0);
}
void DFS(int node) {
  mark(node);
  if (b[node] != INF && !marked[b[node]]) DFS(b[node]);
  pair<int, int> aux = tree.query(1, a[node]);
  int bj = aux.first;
  int viz = aux.second;
  while (bj > node) {
    DFS(viz);
    pair<int, int> aux = tree.query(1, a[node]);
    bj = aux.first;
    viz = aux.second;
  }
  order.push_back(node);
  return;
}
int main(void) {
  scanf(" %d", &n);
  for (int i = 1; i <= n; i++) {
    scanf(" %d", &a[i]);
    if (a[i] == -1) a[i] = INF;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] != INF) b[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    if (!b[i]) b[i] = INF;
  }
  tree.build(b, n);
  for (int i = 1; i <= n; i++) {
    if (!marked[i]) DFS(i);
  }
  for (int i = 0; i < n; i++) {
    ans[order[i]] = i + 1;
  }
  for (int i = 1; i <= n; i++) {
    if (i != 1) printf(" ");
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}
