No tag edit access

E. Summer Reading

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputAt school Vasya got an impressive list of summer reading books. Unlike other modern schoolchildren, Vasya loves reading, so he read some book each day of the summer.

As Vasya was reading books, he was making notes in the Reader's Diary. Each day he wrote the orderal number of the book he was reading. The books in the list are numbered starting from 1 and Vasya was reading them in the order they go in the list. Vasya never reads a new book until he finishes reading the previous one. Unfortunately, Vasya wasn't accurate and some days he forgot to note the number of the book and the notes for those days remained empty.

As Vasya knows that the literature teacher will want to check the Reader's Diary, so he needs to restore the lost records. Help him do it and fill all the blanks. Vasya is sure that he spends at least two and at most five days for each book. Vasya finished reading all the books he had started. Assume that the reading list contained many books. So many, in fact, that it is impossible to read all of them in a summer. If there are multiple valid ways to restore the diary records, Vasya prefers the one that shows the maximum number of read books.

Input

The first line contains integer *n* — the number of summer days (2 ≤ *n* ≤ 2·10^{5}). The second line contains *n* integers *a*_{1}, *a*_{2}, ... *a*_{n} — the records in the diary in the order they were written (0 ≤ *a*_{i} ≤ 10^{5}). If Vasya forgot to write the number of the book on the *i*-th day, then *a*_{i} equals 0.

Output

If it is impossible to correctly fill the blanks in the diary (the diary may contain mistakes initially), print "-1".

Otherwise, print in the first line the maximum number of books Vasya could have read in the summer if we stick to the diary. In the second line print *n* integers — the diary with correctly inserted records. If there are multiple optimal solutions, you can print any of them.

Examples

Input

7

0 1 0 0 0 3 0

Output

3

1 1 2 2 3 3 3

Input

8

0 0 0 0 0 0 0 0

Output

4

1 1 2 2 3 3 4 4

Input

4

0 0 1 0

Output

1

1 1 1 1

Input

4

0 0 0 3

Output

-1

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jul/22/2017 01:48:33 (c2).

Desktop version, switch to mobile version.

User lists

Name |
---|