{"problem":{"name":"Friendly Rabbits","description":{"content":"There are $N$ rabbits, numbered $1$ through $N$. The $i$\\-th ($1≤i≤N$) rabbit likes rabbit $a_i$. Note that no rabbit can like itself, that is, $a_i≠i$. For a pair of rabbits $i$ and $j$ ($i＜j$), we c","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"codefestival_2016_qualA_b"},"statements":[{"statement_type":"Markdown","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.\n\n## Constraints\n\n*   $2≤N≤10^5$\n*   $1≤a_i≤N$\n*   $a_i≠i$\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$a_1$ $a_2$ $...$ $a_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"codefestival_2016_qualA_b","tags":[],"sample_group":[["4\n2 1 4 3","2\n\nThere are two friendly pairs: $(1，2)$ and $(3，4)$."],["3\n2 3 1","0\n\nThere are no friendly pairs."],["5\n5 5 5 5 1","1\n\nThere is one friendly pair: $(1，5)$."]],"created_at":"2026-03-03 11:01:13"}}