cho.sh
Notes
Loading...

Permutation Restoration

Time limit

0.55s

Memory limit

128 MB

Problem

There is a permutation containing each integer from 1 to N exactly once. For each value i, the i-th value of its inversion sequence is the number of values smaller than i that appear to the right of i in the permutation.

For example, the permutation 2 4 5 1 7 6 3 8 has inversion sequence 0 1 0 2 2 1 2 0.

Given an inversion sequence, write a program that restores the corresponding permutation.

Input

The first line contains the size N of the permutation. (1 <= N <= 100,000)

The second line contains the inversion sequence for the values 1, 2, ..., N, separated by spaces.

Output

Print the permutation corresponding to the given inversion sequence on one line, with values separated by spaces.