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

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 xs ys

solve :: [[Int]] -> [[Int]] -> Int
solve xs ys = go (reverse $ sort xs) (reverse $ sort ys)
  where
    go :: [[Int]] -> [[Int]] -> Int
    go [] _ = 0
    go (a:as) cs
      | isNothing found = go as cs
      | otherwise = 1 + go as (delete (fromJust found) cs)
      where
        found = find a cs

    find :: [Int] -> [[Int]] -> Maybe [Int]
    find a cs
      | null candidates = Nothing
      | otherwise = Just (head candidates)
      where
        candidates = filter (isGoodFriends a) cs

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