# Problem M

Mirinae

There are $N$ planets in Vita’s galaxy. In order to improve the security of the planets, Vita assigned each planet to guard exactly one other planet. In particular, the $i$-th planet guards the $A_ i$-th planet for every $1 \le i \le N$.

Vita wants to construct a protective barrier surrounding multiple planets. Let the set of planets to be protected by the barrier be $S$, then each planet in $S$ must be guarding a planet not in $S$.

Help Vita determine the maximum number of planets to be protected by the barrier.

## Input

The first line of input contains an integer $N$ ($2 \leq N \leq 10^6$), the number of planets.

The second line contains $N$ integers. For every $1 \le i \le N$, $i$-th integer represents $A_ i$ ($1 \le A_ i \le N$, $A_ i \ne i$), which means the $i$-th planet guards the $A_ i$-th planet.

## Output

Output a single integer, the maximum number of planets in the protective barrier.

Sample Input 1 | Sample Output 1 |
---|---|

6 3 6 2 5 4 3 |
3 |