import scala.io.StdIn.{readLine, readInt};
object Main {
    def main(args: Array[String]): Unit = {
        readInt;
        val s = readLine.split(" ").map(_.toLong);
        readInt;
        val t = readLine.split(" ").map(_.toLong);
        val ret = t.foldLeft(0) { (cnt, i) => if (binSearch(i, s)) {cnt + 1}else {cnt}};
        println(ret);
    }
    
    def binSearch(target: Long, arr: Array[Long]): Boolean = {
        def go(first: Int, last: Int): Boolean = {
            val pivot = (first + last) / 2;
            if (target == arr(pivot)) true;
            else if (first == last) false;
            else if (target < arr(pivot)) go(first, pivot);
            else go(pivot + 1, last);
        }
        go(0, arr.length - 1);
    }
}
