fun main(args: Array<String>) { 
    readLine()!!.toInt()
    val sList = readLine()!!.split(" ").map { it.toInt() } as MutableList
    readLine()!!.toInt()
    val tList = readLine()!!.split(" ").map { it.toInt() }

    var total = 0
    for (number in tList) {
        if (linearSearch(number, sList)) total ++
    }
    println(total)
}

fun linearSearch(target: Int, list: MutableList<Int>) : Boolean {
    for (number in list)  {
        if (number == target) return true
    }
    return false
}

