def binarySearch(a, key)
	left = 0
	right = a.size
	while left < right
		mid = (left + right) / 2
		if a[mid] == key
			return true
		elsif key < a[mid]
			right = mid
		else
			left = mid + 1
		end
	end
	return false
end

n = gets.to_i
s = gets.split.map &:to_i
q = gets.to_i
t = gets.split.map &:to_i

s.sort!
sum = 0
t.each do |val|
	sum += 1 if binarySearch(s, val)
end

puts sum