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

object Main extends App {
  val n = readInt
  val S = readLine.split(" ").map(_.toInt)
  val q = readInt()
  val T = readLine.split(" ").map(_.toInt)
  var count = 0

  def linearSearch(n: Int, key: Int): Boolean = {
    var i = 0
    val appended = S :+ key
    while (appended(i) != key) i += 1
    if (i == n) false else true
  }

  for (e <- T) {
    if (linearSearch(n, e)) count += 1
  }

  println(count)
}

