fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val sMap = (0 until n).map { readLine()!! }.groupBy { it }.mapValues { it.value.count() }
    val m = readLine()?.toInt() ?: return
    val tMap = (0 until m).map { readLine()!! }.groupBy { it }.mapValues { it.value.count() }

    val resultMap = mutableMapOf<String, Int>().apply {
        sMap.forEach {
            this[it.key] = it.value
        }
    }

    for (entry in tMap) {
        if (entry.key in sMap.keys) {
            resultMap[entry.key] = (resultMap[entry.key]!! - entry.value)
        }
    }

    val max = resultMap.values.max()!!
    println(if (max >= 0) max else 0)
}