# Didu Hia's Signifier Cycles Estimated time limit: 0.5 seconds. Memory limit: 128 MB. The deployed limit is twice the largest per-input median runtime of the reference program on the target judge, rounded up to a multiple of $0.5$ seconds. See the [reference measurements](../../../docs/评测环境与性能.md). ## Story “Little bro! How are you supposed to eat like that?” There are $n$ Didu Hia, numbered $1,\ldots,n$ . Each Didu Hia points to exactly one Didu Hia. Following these pointers may lead around a cycle. Count all the Didu Hia that lie on cycles, counting each one only once. ## Formal Problem Statement There are $n$ vertices labeled $1,\ldots,n$ . Every vertex $i$ has exactly one outgoing edge, pointing to $d_i$ . A cycle consists of distinct vertices $v_1,\ldots,v_k$ with $d_{v_i}=v_{i+1}$ for $1\le i