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

c = 0
t.each { |i|
	top = 0
	last = n-1

	while top<=last
		mid = (top + last) / 2
		if s[mid] == i
			c += 1
			break
		elsif s[mid] > i
			last = mid - 1
		else
			top = mid + 1
		end
	end
}
puts c