import scala.io.StdIn.{readLine, readInt}
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt
        val arr = readLine.split(" ").map(_.toLong)
        readInt
        val ret = readLine.split(" ").map(_.toLong).foldLeft(0) {(num, v) =>
            if (binSearch(v, arr, len)) num + 1 else num
        }
        println(ret)
    }
    def binSearch(needle: Long, arr: Array[Long], length: Int): Boolean = {
        def go(leftPtr: Int, rightPtr: Int): Boolean = ((leftPtr + rightPtr) / 2) match {
            case median if needle == arr(median) => true
            case median if  leftPtr == rightPtr => false 
            case median if needle > arr(median) => go(median + 1, rightPtr)
            case median if needle < arr(median) => go(leftPtr, median)
        }
        go(0, length - 1)
    }
}
