import java.util.ArrayDeque
import java.util._
import java.io._
import scala.io.Source
import scala.io.StdIn._
object Main {
    def main(args: Array[String]): Unit = {
      var count = 0
      var n = readInt
      var S = new Array[Int](n)
      for(i <- 0 until n){
        S(i) = readInt
      }
      var q = readInt
      for(i <- 0 until q){
        if(S.contains(readInt)){
          count += 1
        }
      }
      println(count)
    }
}