Welcome to ZOJ
Select Problem
ZOJ Problem Set - 3365
Integer Numbers

Time Limit: 1 Second      Memory Limit: 32768 KB      Special Judge

The boy likes numbers. He has a sheet of paper. He have written a sequence of consecutive integer numbers on the sheet. The boy likes them.

But then the girl came. The girl is cruel. She changed some of the numbers.

The boy is disappointed. He cries. He does not like all these random numbers. He likes consecutive numbers. He really likes them. But his numbers are not consecutive any more. The boy is disappointed. He cries.

Help the boy. He can change some numbers. He would not like to change many of them. He would like to change as few as possible. He cannot change their order. He would like the numbers to be consecutive again. Help the boy.


The first line of the input file contains n --- the number of numbers in the sequence (1 ≤ n ≤ 50000). The next line contains the sequence itself --- integer numbers not exceeding 109 by their absolute values.

There are multiple cases. Process to the end of file.


Output the minimal number of numbers that the boy must change. After that output the sequence after the change.

Sample Input

5 4 5 2 1 8

Sample Output

3 4 5 6 7 8

Author: Andrew Stankevich
Source: Andrew Stankevich's Contest #11
Submit    Status