import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> getl read <*> getl (map read . words) >>= print

solve :: Int -> [Int] -> Int
solve n xs = fst $ foldl f (1,H) $ map tr $ zip (tail xs) xs
  where
    tr (x, y)
      | x == y = H
      | x > y = D
      | otherwise = U
    f (c, prs) cts = case (prs, cts) of
      (H, H) -> (c, H)
      (H, U) -> (c, U)
      (H, D) -> (c, D)
      (U, H) -> (c, U)
      (U, U) -> (c, U)
      (U, D) -> (c+1, H)
      (D, H) -> (c, D)
      (D, U) -> (c+1, H)
      (D, D) -> (c, D)

data State = U | D | H

getl :: (String -> a) -> IO a
getl f = f <$> getLine
