Trida attached $$$n$$$ cables to $$$2n$$$ sockets arranged from left to right. Every cable has a label from $$$1$$$ to $$$n$$$, and its two ends are attached to the two sockets carrying its label.
Two cables are tangled when their ends alternate along the row. In other words, cables $$$x$$$ and $$$y$$$ are tangled if the four relevant labels appear in the order $$$x,y,x,y$$$ or $$$y,x,y,x$$$, with other labels possibly between them.
Trida will remove exactly one entire cable, including both of its ends. Find all cables she can remove so that no two remaining cables are tangled. If zero or one cable remains after the removal, there is no tangled pair.
The first line contains one integer $$$n$$$ ($$$1 \le n \le 2 \times 10^5$$$), the number of cables.
The second line contains $$$2n$$$ integers $$$a_1,a_2,\ldots,a_{2n}$$$ ($$$1 \le a_i \le n$$$). Every integer from $$$1$$$ to $$$n$$$ occurs exactly twice.
On the first line, print the number $$$k$$$ of cables whose removal leaves no tangled pair.
On the second line, print their $$$k$$$ labels in increasing order. If $$$k=0$$$, print an empty second line.
41 2 1 3 2 4 4 3
1 2
In the sample, removing cable $$$2$$$ leaves the sequence $$$1,1,3,4,4,3$$$, which has no tangled pair. Removing any other cable leaves at least one tangled pair.
| Название |
|---|


