import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  T.getLine
  ps <- map unsafeSignedDecimal . T.words <$> T.getLine :: IO [Int]
  let
    (_, _, k) = foldr step (Nothing, Nothing, 0) $ ps
    step p (Just p', Just p'', k) = (Just p, Just p', if (p < p' && p' < p'') || (p'' < p' && p' < p) then succ k else k)
    step p (Just p', _, _) = (Just p, Just p', 0)
    step p _ = (Just p, Nothing, 0)
  print k

unsafeSignedDecimal :: T.Text -> Int
unsafeSignedDecimal s = case T.signed T.decimal s of
  Right (n, _) -> n
