import qualified Data.List as L main :: IO () main = do _ <- getLine w <- map read . words <$> getLine _ <- getLine b <- map read . words <$> getLine print $ solve w b solve :: [Int] -> [Int] -> Int solve w b = max (solve' w' b') (solve' b' w') where w' = L.sort w b' = L.sort b solve' :: [Int] -> [Int] -> Int solve' [] _ = 0 solve' (t:h) c = solve'' (c, h) 1 t where solve'' :: ([Int], [Int]) -> Int -> Int -> Int solve'' ([], _) n _ = n solve'' (a, d) n p = case dropWhile (<= p) a of [] -> n (g:u) -> solve'' (d, u) (n + 1) g