cho.sh
Notes
Loading...

Switches and Bulbs

Time limit

1s

Memory limit

128 MB

Problem

There is a switching box with N switches on the left and N light bulbs on the right. Every switch and every bulb is numbered from 1 to N, and the switch and bulb with the same number are connected by a wire.

When one switch is pressed, its connected bulb lights up. When several switches are pressed at the same time, a bulb lights only if its wire does not intersect any other wire from the pressed switches.

Given the vertical order of the switches and the vertical order of the bulbs, choose switches so that as many bulbs as possible light up.

Input

The first line contains the integer N (1 <= N <= 10,000), the number of switches and bulbs.

The second line contains the N switch numbers in order from top to bottom.

The third line contains the N bulb numbers in order from top to bottom.

Output

On the first line, print the maximum number of bulbs that can be lit.

On the second line, print the numbers of the switches to press in increasing numeric order, separated by spaces. If there is more than one valid answer, print any one of them.