fun main(args: Array<String>) {
    val N = readLine()?.toInt()?: 0
    val s = Array<String>(N,{it.toString()})
    val set = mutableSetOf<String>();
    for(i in 0..N-1){
      s[i] = readLine()!!
      set += s[i];
    }
    val M = readLine()?.toInt()?: 0
    val t = Array<String>(M,{it.toString()})
    for(i in 0..M-1){
      t[i] = readLine()!!
    }
    var ans = 0;
    set.map{word ->
    val result = plusCount(word, s) - minusCount(word, t)
    if(result > ans) ans = result
    }
    if(ans < 0) println("0") else println(ans)

}

fun plusCount(set: String, s: Array<String>): Int {
  return s.filter{str -> set == str}.count()
}
fun minusCount(set: String, t: Array<String>): Int {
  return t.filter{str -> set == str}.count()
}