n = gets.to_i
s = gets.split( " " ).map { |val| val.to_i }
q = gets.to_i
t = gets.split( " " ).map { |val| val.to_i }
t.sort!

cnt = 0
for i in ( 0 ... q )
	low = 0
	high = n - 1
	while low <= high
		m = ( low+high )//2
		if t[i] < s[m]
			high = m - 1
		elsif s[m] < t[i]
			low = m + 1
		else t[i] == s[m]
			cnt += 1
			break
		end
	end
end

puts( cnt )