def binary_search(array, target)
	return nil if array.empty?
	pivot = array.size / 2
	if array[pivot] == target
		pivot
	elsif target < array[pivot]
		binary_search(array[0...pivot], target)
	else
		binary_search(array[(pivot + 1)..-1], target)
	end
end

n = STDIN.gets.to_i
s = STDIN.gets.split[0...n].map(&:to_i)

q = STDIN.gets.to_i
t = STDIN.gets.split[0...q].map(&:to_i)

count = 0
t.each do |te|
	count += 1 if binary_search(s, te)
end
p count