fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = mutableListOf<String>()
    for (i in 0 until n) {
        s.add(readLine()!!)
    }

    val m = readLine()!!.toInt()
    val t = mutableListOf<String>()
    for (i in 0 until m) {
        t.add(readLine()!!)
    }

    var max = 0

    for (i in 0 until n) {
        var score = 0
        val target = s[i]
        for (j in 0 until n) {
            if (s[j] == target) {
                score += 1
            }
        }

        for (j in 0 until m) {
            if (t[j] == target) {
                score -= 1
            }
        }

        max = Math.max(max, score)
    }

    println(max)
}