10272: CF EDU - Segment Tree P1 - Step 3 - B. Inversions 2
[Creator : ]
Description
This problem is the reversed version of the previous one. There was a permutation $p_i$ of $n$ elements, for each $i$ we wrote down the number $a_i$, the number of $j$ such that $j<i$ and $p_j>p_i$. Restore the original permutation for the given $a_i$.
Input
The first line contains the number $n\ (1≤n≤10^5)$.
The second line contains $n$ numbers $a_i$. It is guaranteed that $a_i$ were obtained from some permutation using the procedure described in the statement.
Output
Print $n$ numbers, the original permutation.
Sample 1 Input
5
0 1 1 0 3
Sample 1 Output
4 1 3 5 2