module Main where

import qualified Data.Map as Map
import Data.List
import Control.Monad

main :: IO ()
main = do
    n  <- read <$> getLine
    rs <- replicateM n $ do
        [x, y] <- map read . words <$> getLine
        return (x, y)
    bs <- replicateM n $ do
        [x, y] <- map read . words <$> getLine
        return (x, y)
    print $ solve rs bs

solve :: [(Int, Int)] -> [(Int, Int)] -> Int
solve [] _ = 0
solve rs bs =
    let (x, y) : rs' = rs
        bCand        = filter (\(a, b) -> x < a && y < b) bs
        compSnd p q = snd p `compare` snd q
    in  if bCand == []
            then solve rs' bs
            else (1 +) $ solve rs' $ delete (minimumBy compSnd bCand) bs
