The city of Hanoi has
You have the ability to toggle the state of a tower of your choice (i.e. empty an occupied tower or occupy an empty tower). But when you do so, towers that are directly adjacent also toggle their state indirectly. Note that if you toggle tower
You are given the task of emptying all
It is guaranteed that this task is possible for the test cases given.
If there are multiple ways to do so, output any one of them.
Constraints
Subtask 1 [20%]
Subtask 2 [30%]
Subtask 3 [50%]
Input Specification
The first line of input will contain an integer
The second line of input will contain 1
indicates the tower is occupied and a 0
indicates the tower is empty.
Output Specification
On the first line, print the total number of steps that you will take. If this number is larger than
On the following lines, print the steps that you will take in order, one on each line. For each step, output the number of the tower that should be directly toggled on that step.
Sample Input 1
6
0 1 1 1 0 0
Sample Output 1
1
3
Sample Input 2
7
1 0 1 1 1 1 1
Sample Output 2
3
1
3
6
Comments
In the problem set you said if you toggle
you toggle 
& 
that means you toggle 
and 
not 
and 
? or am i wrong ?
The problem statement refers to the fact that toggling a tower also toggles those adjacent. Tower
is only adjacent to tower 
, since there is no tower 
, and tower 
is only adjacent to tower 
. This exception exists only for towers 
and 
, since all other towers have two others adjacent, one in front and one behind.