import Data.List
import Data.Bool

main = print . solve . drop 1 . map read . words =<< getContents

solve :: [Int] -> Int
solve xs = func xs 1 0
    where
        func [] _ t = t
        func [x] i t = bool t (t+1) $ x == i
        func (x:y:xs') i t
            | x == i || y == i+1 = func xs' (i+2) (t+1)
            | otherwise = func xs' (i+2) t
