f :: [Int] -> Ordering -> Int
f [_] _ = 1
f (a:b:as) ord =
    if ord /= EQ && ord' /= EQ && ord /= ord'
        then f (b:as) EQ + 1
        else f (b:as) ord'
  where ord' = compare a b

main = do
    n <- readLn :: IO Int
    a <- map read . words <$> getLine :: IO [Int]
    print $ f a EQ