fun main() {
    val n = readLine()!!.toInt()
    val blue = HashMap<String, Int>()
    for (i in 0 until n) {
        val str= readLine()!!
        blue[str]?.let {
            blue[str] = it + 1
        }
        if (blue[str] == null) {
            blue[str] = 1
        }
    }

    val m = readLine()!!.toInt()
    val red = HashMap<String, Int>()
    for (i in 0 until m) {
        val str= readLine()!!
        red[str]?.let {
            red[str] = it + 1
        }
        if (red[str] == null) {
            red[str] = 1
        }
    }

    var max = 0
    for (x in blue) {
        val redValue = red[x.key] ?: 0
        val tmp = x.value - redValue
        if (max < tmp) {
            max = tmp
        }
    }

    print(max)
}