#PERMTGEN. Permutation Generator
Permutation Generator
Hasan Jaddouh has invented a new algorithm for generating permutations this algorithm takes an array with length N as input and generate a permutation with length N from this array.
The array must satisfy (1 <= Ai <= i) in order for the resulting array to be a permutation. Here is the pseudo code of the algorithm:
read N for i=1 to N do read A[i] for i=1 to N do for j=1 to i-1 do if A[j] >= A[i] do A[j] = A[j]+1 for i=1 to N do print A[i]
but unfortunately for Hasan Jaddouh, his algorithm is too slow for big arrays so he asked you to help him to find a fast way to implement his algorithm.
your program should read input same as the pseudo code and output the new array.
Input
first line contains integer N (1 <= N <= 105).
second line contains N integers separated by spaces each integer is between 1 and 109 inclusive.
Note: in order for Hasan Jaddouh's algorithm to work and generate a permutation the constraint (1 <= Ai <= i) must be satisfied but to make this problem harder this constraint is not guaranteed so it's also not necessary that the output is a permutation.
Output
Output N integers separated by spaces, the new array after applying Hasan Jaddouh's algorithm.
Example
Input: 4 4 2 1 3</p>Output: 7 4 1 3