import           Control.Monad
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

data Trend = Inc | Dec | Neu

main = do
  n <- getInt
  (a:as) <- getIntList

  let solve [] _ _ res = res
      solve (x:xs) y Inc res | x >= y    = solve xs x Inc res
                             | otherwise = solve xs x Neu (res+1)
      solve (x:xs) y Dec res | x <= y    = solve xs x Dec res
                             | otherwise = solve xs x Neu (res+1)
      solve (x:xs) y Neu res | x == y    = solve xs x Neu res
                             | x > y     = solve xs x Inc res
                             | otherwise = solve xs x Dec res

  print $ solve as a Neu 1