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