import Data.List
import Data.Function
import Control.Monad
import Control.Applicative
import Debug.Trace

toPair [x,y] = (x,y)

f (a, b) bs = do
  let s = take 1 $ sortBy (compare `on` snd) $ filter (\(x, y) -> x > a && y > b) bs
  (s, bs \\ s)

g [] bs s = reverse s
g (r:rs) bs s = do
  let (b, bs') = f r bs
  g rs bs' (b ++ s)

main = do
  n <- read <$> getLine :: IO Int
  rs <- sort <$> map (toPair.map read.words) <$> replicateM n getLine :: IO [(Int,Int)]
  bs <- sort <$> map (toPair.map read.words) <$> replicateM n getLine :: IO [(Int,Int)]
  --let rs = reverse $ sort [(0,0), (7,3), (2,2), (4,8), (1,6)]
  --let bs = reverse $ sort [(8,5), (6,9), (5,4), (9,1), (3,7)]
  print $ length $ g rs bs []
