import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List

main = do
  getLine
  li <- BS.getLine
  let as = unfoldr (BS.readInt . BS.dropWhile isSpace) li
  let ans = compute as
  print ans

compute :: [Int] -> Int
compute (a:as) = ans where (ans,_,_) = foldl' step (1,EQ,a) as

-- カウント、上昇中/下降中/不明、前の値
type Acc = (Int,Ordering,Int)
step :: Acc -> Int -> Acc
step (n,o,z) a = case (o,compare z a) of
  (EQ, o') -> (n, o', a)
  (LT, GT) -> (succ n, EQ, a)
  (GT, LT) -> (succ n, EQ, a)
  _        -> (n, o, a)
