main = do
  getLine
  as <- map read . words <$> getLine
  print $ solve 1 (as::[Int])

solve :: Int -> [Int] -> Int
solve _ [] = 0
solve n [a]
  | n == a = 1
  | otherwise = 0
solve n (a1:a2:as)
  | a1 == n || a2 == n+1 = 1 + solve (n+2) as
  | otherwise = solve (n+2) as