import java.util.ArrayDeque
import java.util._
import java.io._
import scala.collection.mutable.Set
import scala.io.StdIn._
 
object Main {
    def main(args: Array[String]): Unit = {
     var n = readInt
     var set = Set[String]()
     var list = readLine.split(" ").map(_.toString)
     for(i <- 0 until n){
       set.add(list(i))
     }
     n = readInt
     val temp = readLine.split(" ")
     var count = 0
     for(i <- 0 until n){
       if(set.contains(temp(i)))count += 1
     }
     println(count)
     
     
    }
}