#include <bits/stdc++.h>
using namespace std;
int n;
int tim;
int a[500010], b[500010];
set<pair<int, int> > s[500010];
int ans[500010];
int vis[500010];
void calc(int u) {
  if (u > n) return;
  vis[u] = 1;
  if (!vis[b[u]]) calc(b[u]);
  for (int i = a[u] - 1; i; i -= i & (-i))
    while (s[i].size() && (*s[i].rbegin()).first > u) {
      int v = (*s[i].rbegin()).second;
      s[i].erase(--s[i].end());
      if (!vis[v]) calc(v);
    }
  ans[u] = ++tim;
}
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]);
    if (a[i] == -1)
      a[i] = n + 1;
    else
      b[a[i]] = i;
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j += j & (-j)) s[j].insert(make_pair(b[i], i));
  for (int i = 1; i <= n; i++)
    if (!vis[i]) calc(i);
  for (int i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
}
