import Data.List
import Control.Monad
main=do
 n<-readLn
 a<-group.sort<$>replicateM n getLine
 m<-readLn
 b<-group.sort<$>replicateM m getLine
 print.maximum$0:(map(\s->(length s)+sum(map(\t->if (head s)/=(head t)then 0 else -length t)b))a)++
  (map(\t-> -(length t)+sum(map(\s->if (head s)/=(head t)then 0 else length s)a))b)
