
import qualified Data.Vector as V
 
main = do
  n <- readLn
  a <- V.fromList .  map read . words <$> getLine
  let
    solve i = if i == n + 1
      then 0
      else (if a V.! (aV.!i) == i then 1 else 0) + solve (i+1)
  print $ solve 0 'div' 2