import Control.Monad
import Data.Maybe
import Data.List
import Data.Array

main :: IO ()
main = do
  n <- readLn
  xs <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  ys <- replicateM n $ map read . words <$> getLine :: IO [[Int]]
  print $ solve'' n xs ys

canBeGoodFriends :: [Int] -> [Int] -> Bool
canBeGoodFriends (a:b:_) (c:d:_) = a < c && b < d

solve'' :: Int -> [[Int]] -> [[Int]] -> Int
solve'' n xs ys = n - (length $ foldl' go blues reds)
  where
    reds = sortOn head xs
    blues = sortOn last ys
    go :: [[Int]] -> [Int] -> [[Int]]
    go bs r = deleteBy canBeGoodFriends r bs

        