import Data.List
import Control.Monad
main=do
 n<-readLn
 s<-group.sort<$>replicateM n getLine
 m<-readLn
 t<-group.sort<$>replicateM m getLine
 print$maximum$[x|i<-s,j<-t,let x = if(head i)==(head j)then((length i)-(length j))else if not (elem (head i) (map head t))then length i else 0]++[0]