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

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

  def search(a:Array[Int],value:Int) = {
    scan(a,value,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)))
  }
}