import scala.io.StdIn.{readInt,readLine}

object Main {
  def search(a:Array[Int],value:Int) = {
    def scan(l:Int,r:Int):Boolean = {
      val mid = (l+2+r)/2-1
      if(l>=r) false
      else if(a(mid) == value) true
      else if(a(mid)<value) scan(mid+1,r)
      else scan(l,mid-1)

    }
    scan(0,a.length-1)
  }

  def main(args:Array[String]) = {
    readInt
    val s = readLine.split(" ").map(_.toInt).toArray
    readInt
    val t = readLine.split(" ").map(_.toInt).toArray
    println(t.count(i=>search(s,i)))
  }
}