Problem: Mike has discovered a new way to encode permutations. If he has a permutation P = [p1, p2, ..., pn], he will encode it in the following way:

Denote by A = [a1, a2, ..., an] a sequence of length n which will represent the code of the permutation. For each i from 1 to n sequentially, he will choose the smallest unmarked j (1 ≤ j ≤ n) such that pi < pj and will assign to ai the number j (in other words he performs ai = j) and will mark j. If there is no such j, he'll assign to ai the number  - 1 (he performs ai = - 1). 

Mike forgot his original permutation but he remembers its code. Your task is simple: find any permutation such that its code is the same as the code of Mike's original permutation.

You may assume that there will always be at least one valid permutation.

Input

The first line contains single integer n (1 ≤ n ≤ 500 000) — length of permutation.

The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ n or ai = - 1) — the code of Mike's permutation.

You may assume that all positive values from A are different.

Output

In first and only line print n numbers p1, p2, ..., pn (1 ≤ pi ≤ n) — a permutation P which has the same code as the given one. Note that numbers in permutation are distinct.

Examples

Input

6
2 -1 1 5 -1 4


Output

2 6 1 4 5 3


Input

8
2 -1 4 -1 6 -1 8 -1


Output

1 8 2 7 3 6 4 5

Note

For the permutation from the first example:

i = 1, the smallest j is 2 because p2 = 6 > p1 = 2.

i = 2, there is no j because p2 = 6 is the greatest element in the permutation.

i = 3, the smallest j is 1 because p1 = 2 > p3 = 1.

i = 4, the smallest j is 5 (2 was already marked) because p5 = 5 > p4 = 4.

i = 5, there is no j because 2 is already marked.

i = 6, the smallest j is 4 because p4 = 4 > p6 = 3.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long PRIME = 999727999;
long long PRIME2 = 999999937;
long long INF = LLONG_MAX / 4;
template <class F1, class F2>
ostream& operator<<(ostream& os, const pair<F1, F2>& p) {
  return os << p.first << ' ' << p.second;
}
template <class F1, class F2>
istream& operator>>(istream& is, pair<F1, F2>& p) {
  return is >> p.first >> p.second;
}
vector<string>& split(const std::string& s, char delim, vector<string>& e) {
  stringstream ss(s);
  string item;
  while (getline(ss, item, delim)) e.push_back(item);
  return e;
}
long long Pow(long long a, long long b, long long Mo) {
  long long ans = 1;
  for (; b; b >>= 1, a = a * a % Mo)
    if (b & 1) ans = ans * a % Mo;
  return ans;
}
long long nCr(long long n, long long r) {
  static long long MAXF = 1e6;
  static std::vector<long long> fact(MAXF, 1);
  for (int i = 1; i < MAXF; ++i) fact[i] = (fact[i - 1] * i) % MOD;
  MAXF = 0;
  return (fact[n] * Pow((fact[r] * fact[n - r]) % MOD, MOD - 2, MOD)) % MOD;
}
vector<int> Zfunc(string& s) {
  int n = s.length();
  vector<int> z(n, 0);
  for (int i = 1, l = 0, r = 0; i < n; i++) {
    if (i <= r) z[i] = min(z[i - l], r - i + 1);
    while (i + z[i] < n && s[i + z[i]] == s[z[i]]) z[i]++;
    if (r < i + z[i] - 1) l = i, r = i + z[i] - 1;
  }
  return z;
}
class SegTree {
 public:
  std::vector<pair<int, int> > data;
  int size;
  pair<int, int> ZERO = make_pair(-1, -1);
  pair<int, int> merge(pair<int, int> l, pair<int, int> r) { return max(l, r); }
  void build(std::vector<int>& v) {
    size = 1;
    int s = v.size();
    while (size < s) size <<= 1;
    data = std::vector<pair<int, int> >(2 * size, ZERO);
    for (int i = 0; i < s; ++i) data[size + i] = make_pair(v[i], i);
    for (int i = size - 1; i > 0; --i)
      data[i] = merge(data[i << 1], data[i << 1 | 1]);
  }
  void change(int index, pair<int, int> value) {
    index += size;
    data[index] = value;
    for (; index > 1; index >>= 1) {
      int index2 = (index >> 1) << 1;
      data[index >> 1] = merge(data[index2], data[index2 | 1]);
    }
  }
  pair<int, int> query(int a, int b) {
    pair<int, int> s = ZERO;
    for (int l = a + size, u = b + size; l < u; l >>= 1, u >>= 1) {
      if (l & 1) s = merge(s, data[l++]);
      if (u & 1) s = merge(s, data[--u]);
    }
    return s;
  }
};
std::vector<std::vector<int> > G;
std::vector<int> order;
std::vector<int> markingtime, flag;
std::vector<int> vv, vv2;
int n;
SegTree st;
void dfs(int s) {
  if (flag[s]) return;
  flag[s] = 1;
  if (vv2[s] != n) dfs(vv2[s]);
  while (1) {
    auto got = st.query(0, vv[s]);
    if (got.first <= s) break;
    st.change(got.second, make_pair(-1, -1));
    dfs(got.second);
  }
  order.push_back(s);
}
int main(int argc, char const* argv[]) {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  vv.resize(n, n);
  vv2.resize(n, n);
  markingtime.resize(n, n);
  flag.resize(n, 0);
  for (int i = 0; i < (int)n; i++) {
    int x;
    cin >> x;
    if (x == -1)
      x = n;
    else
      x--;
    if (x != n) {
      vv[i] = x;
      vv2[x] = i;
      markingtime[x] = i;
    }
  }
  st.build(markingtime);
  for (int i = 0; i < (int)n; i++) dfs(i);
  std::vector<int> ans(n);
  for (int i = 0; i < (int)n; i++) ans[order[i]] = i + 1;
  for (auto x : ans) cout << (x) << " ";
  return 0;
}