fun main(args: Array<String>) = p18()

fun p18() {
    readLine()
    val sSet = readLine()!!.split(' ').map { it.toInt() }.toSet()
    readLine()
    val qList = readLine()!!.split(' ').map { it.toInt() }

    val answer = qList.count { it in sSet }

    println(answer)
}

