Under construction

Still being built. Things may change

Couple Breaker Minwook (Small)

Time limit1sMemory limit1024 MB

Summary
Split a row of N people into the fewest contiguous groups, then reorder the groups so that no couple stands next to each other.
Level

Medium7 of 10

Topics
Array, Greedy, Graph
Solved
No attempts yet

Problem

In the Small version, output only 1 of the possible arrangements.

Minwook, the Couple Breaker, is single, so he dislikes seeing couples together. He finds a waiting line of NN people standing in a row. He will split this line into MM groups and then reorder the groups so that no two members of a couple stand next to each other. However, he cannot reverse the order of people within a group or rearrange them. The groups may have different sizes.

If MM is large, reordering the groups becomes a headache for Minwook, so he wants MM to be as small as possible. For the minimum MM, he wants to find just one of the possible arrangements.

Input

The first line contains an integer NN (1≤N≤1031 \le N \le 10^{3}), the number of people.

The second line contains integers a1,a2,a3,⋯ ,aNa_{1}, a_{2}, a_{3}, \cdots, a_{N} (0≤ai≤1030 \le a_{i} \le 10^{3}), separated by spaces. aia_{i} describes the person standing at position ii from the front. If ai=0a_i = 0, that person is single. If ai=aja_i = a_j and ai≠0a_i \ne 0, persons ii and jj are a couple. Every nonzero value appears exactly twice in a1,a2,a3,⋯ ,aNa_{1}, a_{2}, a_{3}, \cdots, a_{N}.

Output

On the first line, print the minimum value of MM.

On the second line, print the number of people in group 1, group 2, ..., group MM, separated by spaces.

On the third line, print the group numbers from the front of the line after the groups are reordered.

If every way of splitting the line into groups and arranging them leaves at least one couple adjacent, print −1-1 on the first line and nothing after it.

Examples2

  1. Example 1

    Input
    6
    3 1 1 3 2 2
    
    Expected output
    3
    2 3 1
    1 3 2
    
  2. Example 2

    Input
    4
    0 0 0 0
    
    Expected output
    1
    4
    1