import Control.Monad
import Control.Applicative
import Data.List

main = do
  n <- readLn
  as <- getInput
  cs <- getInput
  print $ countSm as cs

getInput = replicateM n $ do
  [x,y] <- map read . words <$> getLine
  return (x,y)

countSm [(Int,Int)] -> [(Int,Int)]  -> Int
countSm [] _ = 0
countSm as cs =
  let
    (x,y):as' = as
    bFilt = filter (\(a,b) -> x < a && y < b) cs
    compY a b = snd a `compare` snd b
    in if null bFilt
      then countSm as' cs
      else 1 + $ countSm as' $ delete (minimumBy compY bFilt) cs
