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

cnt = 0
for i in ( 0 ... q )
	for j in ( 0 ... n )
		if s[i] == t[j]
			cnt += 1
			break
		end
	end
end

puts( cnt )