import kotlin.math.*

fun str() = readLine()!!
fun int() = readLine()!!.toInt()

fun main() {
	val n = int()
	val blue = Array(n) {str()}
	val m = int()
	val red = Array(m) {str()}

	var r = 0
	for(i in 0 until n-1) {
		var count = 1
		for(j in i+1 until n)
			if(blue[i]==blue[j]) ++count
		for(j in 0 until m)
			if(blue[i]==red[j]) --count
		r = max(r,count)
	}

	println(r)
}
