object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN) = readLine.split(" ").map(_.toInt)
    val cardB = for(i <- 1 to datN) yield (readLine.split(" ").head)
    val Array(datM) = readLine.split(" ").map(_.toInt)
    val cardR = for(i <- 1 to datM) yield (readLine.split(" ").head)

    def countCard(result: Map[String, Int], card: List[String]): Map[String, Int] = card match {
      case Nil => result
      case head :: tail => {
        val result2 = result + (head -> (result.getOrElse(head, 0) + 1))
        countCard(result2, tail)
      }
    }
    val cardB2 = countCard(Map(), cardB.toList).toList
    val cardR2 = countCard(Map(), cardR.toList)

    val countup = cardB2.map(e => e._2 - cardR2.getOrElse(e._1, 0))

    val ans = math.max(countup.max, 0)

    println(ans)
  }
}
