/**
 * 線形探索
 */
fun main(args: Array<String>) {

    Main.init()

    Main.execute()
}

class Main {

    companion object {

        private lateinit var inputs: List<String>

        private lateinit var searchLists: List<String>

        fun init() {

            readLine()

            inputs = readLine()!!.split(" ")

            readLine()

            searchLists = readLine()!!.split(" ")
        }

        fun execute() {
            println(searchLists.count {
                inputs.contains(it)
            })
        }
    }
}


