#include <bits/stdc++.h>
int n;
int a[500009], ans[500009], p[500009], b[500009], tot;
int num[2000009];
inline void build(int u, int l, int r) {
  if (l == r) {
    num[u] = b[l];
    return;
  }
  register int mid(l + r >> 1);
  build(u << 1, l, mid);
  build(u << 1 | 1, mid + 1, r);
  num[u] = (num[u << 1] > num[u << 1 | 1] ? num[u << 1] : num[u << 1 | 1]);
}
inline void change(int u, int l, int r, const int& x) {
  if (l == r) {
    if (l == x) num[u] = 0;
    return;
  }
  register int mid(l + r >> 1);
  if (x <= mid)
    change(u << 1, l, mid, x);
  else
    change(u << 1 | 1, mid + 1, r, x);
  num[u] = (num[u << 1] > num[u << 1 | 1] ? num[u << 1] : num[u << 1 | 1]);
}
inline void dfs(int u);
inline void query(int u, int l, int r, int x, const int& y) {
  if (l == r) {
    if (l < x && num[u] > y) dfs(l);
    return;
  }
  register int mid(l + r >> 1);
  if (num[u << 1] > y) query(u << 1, l, mid, x, y);
  if (mid + 1 < x && num[u << 1 | 1] > y) query(u << 1 | 1, mid + 1, r, x, y);
}
inline void dfs(int u) {
  if (b[u] == 0) return;
  register int q(b[u]);
  b[u] = 0;
  change(1, 1, n, u);
  if (q <= n && q > 0 && b[q] > 0) {
    dfs(q);
  }
  query(1, 1, n, ((a[u] == -1) ? (n + 1) : a[u]), u);
  ans[++tot] = u;
}
int main() {
  scanf("%d", &n);
  memset(b, 1, sizeof(b));
  for (int i(1); i <= n; ++i) {
    scanf("%d", a + i);
    if (a[i] > 0) b[a[i]] = i;
  }
  build(1, 1, n);
  for (int i(1); i <= n; ++i) {
    if (b[i] > 0) {
      dfs(i);
    }
  }
  for (int i(1); i <= n; ++i) {
    p[ans[i]] = i;
  }
  for (int i(1); i <= n; ++i) {
    printf("%d ", p[i]);
  }
}
