def binarySearch left, right, arr, val
	mid = left + (right - left) / 2
	return true if arr[mid] == val

	if arr[mid] > val
		right = mid - 1
	else
		left = mid + 1
	end

	return false if left > right
	binarySearch(left, right, arr, val)
end

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

c = 0
t.each{|val| c += 1 if binarySearch(0, n - 1, s, val)}
puts c