import Control.Monad
main :: IO ()
main = do
  a <- readLn :: IO Int
  acs <- replicateM a getLine :: IO [String]
  b <- readLn :: IO Int
  bcs <- replicateM b getLine :: IO [String]
  let ps = [ap-bp| ac <- acs, let ap = length $ filter (==ac) acs, let bp = length $ filter(==ac) bcs]
  print $ if minimum ps <= 0 then 0 else maximum ps