num_of_ary0 = gets.to_i
ary0        = gets.split.map &:to_i
num_of_ary1 = gets.to_i
ary1        = gets.split.map &:to_i

answer = 0

ary1.each{ |n| if ary0.include?(n) then answer += 1 end }

puts answer

