{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
import Data.Maybe (fromJust)
import qualified Data.ByteString.Char8 as S8
import qualified Data.Vector as V
getInt :: IO Int
getInt = (fst .fromJust . S8.readInt) <$> S8.getLine
getInts :: IO [Int]
getInts = map (fst .fromJust . S8.readInt) . S8.words <$> S8.getLine
main = do
  n <- getInt
  as <- getInts
  print $ solve n as
  return ()

solve :: Int -> [Int] -> Int
solve n as = (`div`2) $ V.sum $ V.zipWith f (V.fromList [1..n]) arr
  where
    arr = V.fromList as
    f ix val | ix  == arr V.! (val - 1) = 1
             | otherwise = 0
