import java.util.HashMap
fun main(args: Array<String>){
    var line: String = readLine() as String
    val n = line.toInt()
    val map:HashMap<String,Int> = HashMap()
    var key:String
    for(i in 0 until n){
        key= readLine() as String
        val j:Int?= map[key]
        if(j!=null){
            map[key] = j+1
        }else{
            map[key] = 1
        }
    }
    line = readLine() as String
    val m = line.toInt()
    for(i in 0 until m){
        key= readLine() as String
        val j:Int?= map[key]
        if(j!=null){
            map[key] = j-1
        }
    }

    var max=0
    for (entry in map.entries) {
        if (max<entry.value) {
            max=entry.value
        }
    }
    print(max)
}