import Control.Applicative
import Control.Monad
import Data.List

main = do
  n <- readLn
  as <- replicateM n getLine
  m <- readLn
  bs <- replicateM m getLine
  print $ solve as bs

solve :: [String] -> [String] -> Int
solve as bs = let
  cs = as \\ bs
  in maximum $ map length $ group $ sort cs
