fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val s = (0 until N).map { readLine()!! }.toList()
    val M = readLine()!!.toInt()
    val t = (0 until M).map { readLine()!! }.toList()

    val S = s.toSet()
    val r = S.map { u -> s.filter { p -> p == u }.size - t.filter { q -> q == u }.size }.plus(0)

    println(r.max())
}