import scala.io.StdIn.{readInt, readLine}
object Main {
    def main(args: Array[String]): Unit = {
        readInt
        val haystack = readLine.split(" ").map(_.toLong).toList
        readInt
        val needles = readLine.split(" ").map(_.toLong)
        println(needles.foldLeft(0) {(sum, v) => if (exists(v, haystack)) sum + 1 else sum})
    }
    def exists[T](needle: T, haystack: List[T]): Boolean = haystack match {
        case Nil => false
        case x :: xs if x == needle => true
        case x :: xs => exists(needle, xs)
    }
}
