n = gets.to_i
S = gets.split.map(&:to_i)
q = gets.to_i
T = gets.split.map(&:to_i)

count = 0

for i in T do
	ll = - 1
	ul = n - 1
	while ll + 1 < ul do
		mid = (ll + ul) / 2
		if i > S[mid] then
			ll = mid
		elsif i < S[mid] then
			ul = mid
		else
			count += 1
			break
		end
	end
	if i == S[ul] then
		count += 1
	end
end 

puts count