import Control.Monad
import Data.List

check ss ts =
  case  group $ sort $ ss \\ ts of
    [] -> 0
    xs -> length $ maximum $ xs
  
  

main = do
  n <- read <$> getLine ::IO Int
  s <- replicateM n $ getLine
  m <- read <$> getLine ::IO Int
  t <- replicateM m $ getLine
  print $ check s t
  
  
