
fun main(args: Array<String>) {
    readLine()!!
    val list: List<Int> = readLine()!!.split(" ").map { it.toInt() }.distinct()
    readLine()!!
    val list2: List<Int> = readLine()!!.split(" ").map { it.toInt() }.distinct()
    var match:Int = 0
    for (i in (0..list.count()-1))
    {
        for (j in (0..list2.count()-1))
        {
            if (list[i]==list2[j])
            {
                match++
                continue
            }
        }
    }
    println(match)
}

