
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
    val len1 = StdIn.readInt
    val arrayA = StdIn.readLine().split(" ").map(_.toInt)
    val len2 = StdIn.readInt
    val arrayB = StdIn.readLine().split(" ").map(_.toInt)

    var count = 0
    for (value <- arrayA) {
      count += searchB(value, arrayB)
    }
    println(count)
  }

  def searchB(value: Int, array: Array[Int]): Int = {
    for (valueB <- array) {
      if (value == valueB) return 1
    }
    return 0
  }
}