import Data.Vector ((!))
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

main :: IO ()
main = do
  n <- readLn
  a <- V.fromList . map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
  let
    solve i = if i == n
      then 0
      else (if (a!(a!i)) == i then 1 else 0) + solve (i+1)
  print $ solve 0
