import qualified Data.ByteString.Char8 as B
import Data.List
 
main = do
  _ <- getLine
  as <- map (maybe undefined fst . B.readInt) . B.words <$> B.getLine
  print (sarray 0 as)
 
sarray acc [] = acc
sarray acc [x] = acc + 1
sarray acc xxs@(x:xs)
  | lg > ls = sarray (acc + 1) (drop (lg + 1) xxs)
  | otherwise = sarray (acc + 1) (drop (ls + 1) xxs)
  where
    ds = map signum $ zipWith (-) xs xxs
    lg = length $ takeWhile (/= -1) ds
    ls = length $ takeWhile (/= 1) ds