import scala.io.StdIn._

object Main extends App {

  def linearSearch(key: Int, a: Array[Int]): Boolean = {
    val added_a = a :+ key
    var i = 0
    while (added_a(i) != key) {
      i += 1
    }
    i != (added_a.size - 1)
  }

  readLine
  val S = readLine.split(" ").map(_.toInt)
  readLine
  val T = readLine.split(" ").map(_.toInt)
  var cnt = 0
  T.foreach{
    case key => if (linearSearch(key, S)) cnt += 1
  }
  println(cnt)
}
