#ABC293B. [ABC293B] Call the ID Number

[ABC293B] Call the ID Number

Score : 200200 points

Problem Statement

There are NN people whose IDs are 11, 22, \ldots, and NN.

Each of person 11, person 22, \ldots, and person NN performs the following action once in this order:

  • If person ii's ID has not been called out yet, call out person AiA_i's ID.

Enumerate the IDs of all the people whose IDs are never called out until the end in ascending order.

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • 1AiN1 \leq A_i \leq N
  • AiiA_i \neq i
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 A2A_2 \ldots ANA_N

Output

Enumerate the IDs of all the people whose IDs are not called out until the end in ascending order in the following format:

KK

X1X_1 X2X_2 \ldots XKX_K

In other words, the first line should contain the number of people, KK, whose IDs are never called out until the end; the second line should contain the sequence (X1,X2,,XK)(X_1, X_2, \ldots, X_K) of IDs of such people in ascending order, with spaces in between.

5
3 1 4 5 4
2
2 4

The five people's actions are as follows.

  • Person 11's ID has not been called out yet, so person 11 calls out person 33's ID.
  • Person 22's ID has not been called out yet, so person 22 calls out person 11's ID.
  • Person 33's ID has already been called out by person 11, so nothing happens.
  • Person 44's ID has not been called out yet, so person 44 calls out person 55's ID.
  • Person 55's ID has already been called out by person 44, so nothing happens.

Therefore, person 22 and 44's IDs are not called out until the end.

20
9 7 19 7 10 4 13 9 4 8 10 15 16 3 18 19 12 13 2 12
10
1 2 5 6 8 11 14 17 18 20