import Data.List

solve :: [Int] -> Int
solve = f . map head . group where
  f (a:b:c:as)
    | signum (a-b) /= signum (b-c) = 1 + f (c:as)
    | otherwise = f (b:c:as)
  f _ = 1

main = getLine >> getLine >>= print.solve.map read.words