import java.util.Scanner

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val S = IntArray(n){scn.nextInt()}
	S.sort()
	val q = scn.nextInt()
	val T = IntArray(q){scn.nextInt()}
	T.sort()
	var ans = 0
	for (t in T){
		if (find(t, S)) ans++
	}
	println(ans)
}

fun find(t: Int, sorted: IntArray): Boolean{
	var (l, r) = Pair(0, sorted.size-1)
	if (sorted[l]==t || sorted[r]==t) return true
	while(r-l>1){
		val h = (l+r)/2
		if (sorted[h]==t) return true
		if (sorted[h]>t) r = h
		else l = h
	}
	return false
}
