Problems
At lunchtime, all students in the class line up to eat lunch. However, every day, students sitting in the front row end up in the front row, eating first, while those sitting in the back end up in the back row, eating later. A teacher, wondering how to change this situation, came up with a solution. Here's how.
After the students line up, the first student draws a number in order.
The first student in line is always given number 0 and stands at the front of the line.
The second student in line picks a number, either 0 or 1. If they pick 0, they remain where they are. If they pick 1, they go to the student in front of them and line up.
The third student in line picks a number: 0, 1, or 2. He or she then moves to the front of the line that number of seats he or she picked.
Students who are in line at the end of the line will then move forward in line according to the number they drew.
The number each person draws is a smaller number than the number they initially drew.
For example, let's say five students stand in line and the numbers 0, 1, 1, 3, and 2 are drawn in order from the first student in line to the fifth student in line. If we number the first to fifth students 1 through 5, the order in which the students stand in line is as follows.
After the first student draws a number: 1
After the second student draws a number: 2 1
After the third student draws a number: 2 3 1
After the fourth student draws a number: 4 2 3 1
After the fifth student draws a number: 4 2 5 3 1
So, the final order in which the students line up is 4 2 5 3 1.
Write a program that prints the final order in which students lined up when given the numbers they drew one by one.
Input
The first line contains the number of students, and the second line contains the numbers chosen by the students in the order they stood in line.
The number of students is less than 100, the numbers chosen by students are 0 or natural numbers, and there is a blank space between the numbers chosen by students.
Output
When students are numbered starting from 1 in the order they initially lined up, the first line prints the number in which the students finally lined up.
Print a space between student numbers.
Example
5
0 1 1 3 2
4 2 5 3 1