import java.util.Scanner

import scala.collection.immutable



object Main extends App {

  def read(): (immutable.IndexedSeq[String], immutable.IndexedSeq[String]) = {
    val sc: Scanner = new Scanner(System.in)
    val n = sc.nextInt
    val blueCards = (1 to n).map { _ =>
      sc.next()
    }
    val m = sc.nextInt
    val redCards = (1 to m).map { _ =>
      sc.next()
    }
    sc.close()
    (blueCards, redCards)
  }

  def solve() = {
    val (blueCards, redCards) = read()
    val blueStrAndNumMap = blueCards.groupBy(identity).mapValues(_.length)
    val redStrAndNumMap = redCards.groupBy(identity).mapValues(_.length)

    blueStrAndNumMap.keys.foldLeft(0) { case (acc, key) =>
      val diff = blueStrAndNumMap(key) - redStrAndNumMap.getOrElse(key, 0)
      Math.max(acc, diff)
    }
  }
  println(solve)

}
