def linearSearch(as, bs)
  n = 0
  for i in bs
    for j in as
      if i == j
        n = n + 1
        break;
      end
    end
  end
  puts n
end


a_size = STDIN.gets.to_i
as = STDIN.gets.split(' ')

b_size = STDIN.gets.to_i
bs = STDIN.gets.split(' ')

linearSearch(as, bs)