import Data.Array

main = do
  li <- getLine
  let n = read li
  li <- getLine
  let as = map read $ words li
  let ans = compute n as
  print ans

compute :: Int -> [Int] -> Int
compute n as = length [ () | (i,ai) <- zip [1..] as, i < ai, i == ar ! ai ]
  where
    ar = listArray (1,n) as
