{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import           Control.Monad         (replicateM)
import qualified Data.ByteString.Char8 as BC
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  n <- readLn
  ss <- replicateM n getLine
  m <- readLn
  ts <- replicateM m getLine
  print $ solve ss ts

solve :: [String] -> [String] -> Int
solve ss ts = maximum $ 0 : map score ss where
  score s = count ss - count ts where
    count = length . filter (== s)
