import java.util.ArrayDeque
import java.util._
import java.io._
import scala.io.Source

object Main {
	val sc = new Scanner(System.in)
	def main(args: Array[String]): Unit = {
	  var count = 0
	  var n = sc.nextInt
	  var S = new Array[Int](n)
	  for(i <- 0 until n){
	    S(i) = sc.nextInt
	  }
	  var q = sc.nextInt
	  for(i <- 0 until q){
	    if(S.contains(sc.nextInt)){
	      count += 1
	    }
	  }
	  println(count)
	}
}