import Data.List
import Data.Ord
main = do
  t <- readLn :: IO Int
  xs <- fmap (map read . words) getLine :: IO [Int]
  print $ solve4 xs
solve4 = solve4' 0 1
solve4' c _ [] = c
solve4' c i (x : []) = if x == i then c + 1 else c
solve4' c i (x : y : xs) = if x == i then solve4' (c + 1) (i + 2) xs else solve4' c (i + 1) (y : xs)
