#d2465. 订单重编号

订单重编号

Order Renumbering

Problem Description

You are given NN positive integers in chronological order, representing the original order numbers. You need to assign a new number to each order, in the same order: for each order, the new number is the smallest integer that is greater than or equal to its original number and has not been used before.

For example, if the original numbers are 1 2 3 11\ 2\ 3\ 1 in order, then the new numbers are 1 2 3 41\ 2\ 3\ 4: the first three orders keep their unused original numbers; the fourth order has original number 11, but 1,2,31, 2, 3 are already used, so its new number is 44.

Input Format

The first line contains an integer NN (1≤N≤5×1051 \le N \le 5 \times 10^5).

The second line contains NN integers aia_i (1≤ai≤1091 \le a_i \le 10^9), representing the original order numbers.

Output Format

Output one line containing NN integers: the new order numbers.

Sample Input 1

6
2 3 4 1 1 1

Sample Output 1

2 3 4 1 5 6

Sample Input 2

3
1000000000 1000000000 1000000000

Sample Output 2

1000000000 1000000001 1000000002

Sample Input 3

6
4 5 1 2 1 1

Sample Output 3

4 5 1 2 3 6