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

c = 0
ta.each { |t|
	s_start = 0
	s_end = n-1
	while true
		i = (s_start + s_end) / 2
		if t == s[i]
			c += 1
			break
		elsif t < s[i]
			s_end = i - 1
		elsif s[i] < t
			s_start = i + 1
		end
	end
}
puts c