main = do
  _ <- getLine
  as <- map read . words <$> getLine
  putStr . show . f $ as

f [] = 0
f [x] = 1
f [x, y] = 1
f (x:y:z:ws)
  | x <= y && y <= z = f (y:z:ws)
  | x >= y && y >= z = f (y:z:ws)
  | otherwise = 1 + f (y:z:ws)


  