import java.util.Scanner
object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    sc.nextLine()
    val intSeq = sc.nextLine().split(" ").toIndexedSeq
    sc.nextLine()
    val sIntSeq = sc.nextLine().split(" ").toIndexedSeq

    println(intSeq.count(sIntSeq.contains(_)))
  }
}

