module Main where

import           Control.Monad
import           Data.List
import           Data.Ord
import           Data.List.Split
import           Data.Array.IO
import qualified Data.Vector.Unboxed as V

main :: IO ()
main = do
  n1 <- readLn
  bs <- group . sort <$> replicateM n1 getLine
  n2 <- readLn
  as <- replicateM n2 getLine

  print $ max 0 $ (maximum . map (f as)) bs
  where
    f as bs = let b = head bs in length bs - (length . filter (== b)) as