object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val s = List.fill(n)(sc.next())
  val m = sc.nextInt()
  val t = List.fill(m)(sc.next())
  val tg = t.groupBy(identity).view.mapValues(_.length).toMap.withDefaultValue(0)
  val ans = s.groupBy(identity).map{
    case (x, p) => p.length - tg(x)
  }.max.max(0)
  println(ans)
}
