int_s = gets.to_i
s_arr = gets.split(" ").map(&:to_i)
int_t = gets.to_i
t_arr = gets.split(" ").map(&:to_i)

count = 0
s_arr.each do |val1|
  t_arr.each do |val2|
    count += 1 if val1 == val2
  end
end

puts count