import java.util.Scanner

object Main extends App {

  val sc = new Scanner(Console.in)

  def nextInt() = sc.next.toInt

  val n = nextInt
  val s = Array.fill(n)(nextInt)

  val q = nextInt
  val t = Seq.fill(q)(nextInt)

  val c = (0 /: t) { (c, e) =>

    def find(xs: Array[Int]): Boolean = {
      def binarySearch(start: Int, end: Int): Boolean = {
        if (start == end)
          e == xs(start)
        else {
          val mid = start + (end - start + 1) / 2
          if (e < xs(mid))
            binarySearch(start, mid - 1)
          else
            binarySearch(mid, end)
        }
      }
      if (xs.length == 0) false
      else binarySearch(0, xs.length - 1)
    }

    if (find(s)) c + 1
    else c
  }
  println(c)
}

