import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val S = mutableListOf<Int>()
    repeat(n) {
        S.add(scanner.nextInt())
    }
    val q = scanner.nextInt()
    val T = mutableListOf<Int>()
    repeat(q) {
        T.add(scanner.nextInt())
    }
    var count = 0
    for (t in T) {
        for (s in S) {
            if (s == t) {
                count++
                break
            }
        }
    }
    println(count)
}

