import scala.collection.mutable

object Main {
  def main(args: Array[String]): Unit = {
    val lines : Array[String] = io.Source.stdin.getLines().toArray
    val n    : Int = lines(0).toInt
    val strs : Array[String] = lines.slice(1, n+1)
    val m    : Int = lines(n+1).toInt
    val strt : Array[String] = lines.slice(2+n, 2+n+m)

    val stock = new mutable.HashMap[String,Int]()

    strs.foreach((s) => {stock.update(s, stock.getOrElse(s, 0) + 1)})
    strt.foreach((t) => {stock.update(t, stock.getOrElse(t, 0) - 1)})
    val ans = stock.map(_.swap).max._1
    println(if (ans < 0) 0 else ans)
  }
}
