{"raw_statement":[{"iden":"problem statement","content":"There are $N$ rabbits, numbered $1$ through $N$.\nThe $i$\\-th ($1≤i≤N$) rabbit likes rabbit $a_i$. Note that no rabbit can like itself, that is, $a_i≠i$.\nFor a pair of rabbits $i$ and $j$ ($i＜j$), we call the pair ($i，j$) a _friendly pair_ if the following condition is met.\n\n*   Rabbit $i$ likes rabbit $j$ and rabbit $j$ likes rabbit $i$.\n\nCalculate the number of the friendly pairs."},{"iden":"constraints","content":"*   $2≤N≤10^5$\n*   $1≤a_i≤N$\n*   $a_i≠i$"},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$a_1$ $a_2$ $...$ $a_N$"},{"iden":"sample input 1","content":"4\n2 1 4 3"},{"iden":"sample output 1","content":"2\n\nThere are two friendly pairs: $(1，2)$ and $(3，4)$."},{"iden":"sample input 2","content":"3\n2 3 1"},{"iden":"sample output 2","content":"0\n\nThere are no friendly pairs."},{"iden":"sample input 3","content":"5\n5 5 5 5 1"},{"iden":"sample output 3","content":"1\n\nThere is one friendly pair: $(1，5)$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}