import Control.Monad
import Data.List
import Data.Ord
import Data.Maybe

main = do
  n <- readLn :: IO Int
  red <- replicateM n getLine >>= return . map ((\[x,y] -> (x,y)) . map read . words) :: IO [(Int,Int)]
  blue <- replicateM n getLine >>= return . map ((\[x,y] -> (x,y)) . map read . words) :: IO [(Int,Int)]

  print $ length $ solve red blue

  where
    solve red blue = solve' (reverse $ sortBy (comparing snd) red) (sortBy (comparing fst) blue)
    solve' [] _ = []
    solve' _ [] = []
    solve' rs (b:bs)
      | isJust r = (r,b) : solve' (delete (fromJust r) rs) bs
      | otherwise = solve' rs bs
      where r = find (\(x,y) -> x < fst b && y < snd b) rs
