main = do
  n <- readLn :: IO Int
  ps <- getLine >>= return . map read . words :: IO [Int]

  print $ solve ps 1

  where
    solve (p:[]) i = if p == i then 1 else 0
    solve (p1:p2:ps) i = if p1 == i then 1 + (solve (p1:ps) (i+1)) else solve (p2:ps) (i+1)
