import scala.io.StdIn

object Main extends App {
  val nLen = StdIn.readInt()
  val ns = StdIn.readLine().split(" ").map(_.toInt)
  val qLen = StdIn.readInt()
  val qs = StdIn.readLine().split(" ").map(_.toInt)

  println(
    qs.count(q => BinarySearch.binarySearch(ns, q))
  )
}

object BinarySearch {
  def binarySearch(xs: Array[Int], x: Int): Boolean = binarySearch(xs, x, 0, xs.length - 1)

  private def binarySearch(xs: Array[Int], x: Int, lSide: Int, rSide: Int): Boolean = {
    if (rSide < lSide) false
    else {
      val mid = lSide + (rSide - lSide) / 2
      if (xs(mid) < x) binarySearch(xs, x, mid + 1, rSide)
      else if (x < xs(mid)) binarySearch(xs, x, lSide, mid - 1)
      else xs(mid) == x
    }
  }
}

