import scala.io.StdIn
object Main extends App {
  def wordsCount(n: Int): Map[String, Int] = (0 until n).foldLeft(Map.empty[String, Int]){
    (acc, _)  =>
      val word = StdIn.readLine().trim
      acc + ( word -> (acc.getOrElse(word, 0) + 1))
    }
  val blueCount = StdIn.readLine().trim.toInt
  val blueWords = wordsCount(blueCount)
  val redCount = StdIn.readLine().trim.toInt
  val redWords = wordsCount(redCount)
  val res = blueWords.foldLeft(0){ (acc, blues) =>
    val newPoint = blues._2 + (-1 * redWords.getOrElse(blues._1, 0))
    if(acc < newPoint) newPoint else acc
  }
  println(res)
}
