import java.util.*

fun binarySearch(S: List<Int>, t: Int): Int {
    tailrec fun search(S: List<Int>, t: Int, s: Int, e: Int): Int {
        if (s > e) {
            return -1
        }
        val index = (s + e) / 2
        val v = S[index]
        return when {
            (v == t) -> index
            (v > t) -> search(S, t, s, index - 1)
            else -> search(S, t, index + 1, e)
        }
    }
    return search(S, t, 0, S.size - 1)
}

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) {
        if (binarySearch(S, t) != -1) {
            count++
        }
    }
    println(count)
}

