n = gets.to_i
s_array = gets.split(" ").map(&:to_i);
q = gets.to_i
t_array = gets.split(" ").map(&:to_i);

j = 0
for i in 0..q-1 do
	left = 0
	right = n
	while left < right do
	    mid = (left + right) / 2
	    if s_array[mid] == t_array[i] then
	        j += 1
			break
	    elsif t_array[i] < s_array[mid] then
	        right = mid
	    else
	        left = mid + 1
		end
	end
end
puts j