import Control.Applicative import Data.List (sort) getInts :: IO [Int] getInts = map read . words <$> getLine main = do _ <- getLine ws <- sort <$> getInts _ <- getLine bs <- sort <$> getInts let f :: Int -> Int -> Int -> [Int] -> [Int] -> Int f h _ 0 [] _ = h f h _ 1 _ [] = h f h pl 0 (w:rs) bs | w > pl = f (h+1) w 1 rs bs | otherwise = f h pl 0 rs bs f h pl 1 ws (b:rs) | b > pl = f (h+1) b 0 ws rs | otherwise = f h pl 1 ws rs in print $ max (f 0 (-1) 0 ws bs) (f 0 (-1) 1 ws bs)