solve :: Int -> Int -> [Int] -> Int
solve _ count [] = count
solve 0 count (x:xs) = solve x count xs
solve status count (x:xs)
  | status == x = solve status count xs
  | status /= x = solve 0 (count+1) xs

check :: [Int] -> [Int]
check [x] = []
check (x:y:xs)
  | y-x > 0 = 1 : check	(y:xs)
  | y-x < 0 = -1 : check (y:xs)
  | otherwise = check (y:xs)

main = do
  n <- getContents
  print $ solve 0 1 $ check $ map read $ tail $ words n