import scala.io.StdIn._

object Main extends App {

  def binarySearch(key: Int, a: Array[Int]): Boolean = {
    var left = 0
    var right = a.size
    while (left < right) {
      val mid = (left + right) / 2
      val x = a(mid)
      if (x == key) {
        return true
      } else if (x > key) {
        right = mid
      } else {
        left = mid + 1
      }
    }
    return false
  }

  readLine
  val S = readLine.split(" ").map(s => s.toInt)
  readLine
  val T = readLine.split(" ").map(s => s.toInt)
  println(T.map(key => binarySearch(key, S)).filter(_ == true).size)
}
