import scala.io.StdIn.{readLine,readInt}

object Main {
  def main(args:Array[String]) = {
    val n = readInt
    val s = readLine.split(" ").map(_.toInt)
    val q = readInt
    val t = readLine.split(" ").map(_.toInt)
    println(t.filter(s.contains(_)).length)
  }
}