module Main where

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

main :: IO ()
main = do
    n <- readLn
    rs <- fmap (sortBy (\(_, b1) (_, b2) -> b2 `compare` b1)) $
        replicateM n $ do
        [a, b] <- fmap read . words <$> getLine :: IO [Int]
        return (a, b)
    bs <- fmap (sortBy (\(a1, _) (a2, _) -> a1 `compare` a2)) $
        replicateM n $ do
        [c, d] <- fmap read . words <$> getLine :: IO [Int]
        return (c, d)
    let f (c, d) (a, b) = a < c && b < d
    let rs' = foldl' (\acc b -> deleteBy f b acc) rs bs
    print $ length rs - length rs'