module Main where

import Control.Applicative
import Control.Monad
import Data.List (sort, group)

f :: [[String]] -> [String] -> Int
f rss (b:bs) = len1 - len2
  where
    len1 = length (b:bs)
    len2 = case filter ((== b) . head) rss of
        []   -> 0
        [cs] -> length cs

main :: IO ()
main = do
    n <- readLn
    ss <- replicateM n getLine
    m <- readLn
    ts <- replicateM m getLine
    let blue = group . sort $ ss
    let red  = group . sort $ ts
    let ans  = maximum $ 0 : fmap (f red) blue
    print ans