object Main extends App {
  val n = readInt
  implicit val S: Array[Int] = readLine.split(" ").map(_.toInt)
  val q = readInt
  val T = readLine.split(" ").map(_.toInt)

  def binarySearch(key: Int, leftIdx: Int, rightIdx: Int)(list: Array[Int]): Boolean = {
    val centerIdx = (rightIdx + leftIdx) / 2
    val centerElem = list(centerIdx)
    if (leftIdx > rightIdx) false
    else if (leftIdx == rightIdx && key != centerElem) false
    else {
      if (key == centerElem) true
      else if (key > centerElem) binarySearch(key, centerIdx + 1, rightIdx)(list)
      else binarySearch(key, leftIdx, centerIdx - 1)(list)
    }
  }
  println(T.count(t => binarySearch(t, 0, S.length)(S)))
}
