n = gets.to_i
s = gets.chomp.split(" ").map(&:to_i).sort!

q = gets.to_i
t = gets.chomp.split(" ").map(&:to_i).sort!

count = 0
until s.empty? or t.empty?
  a = s[0]
  b = t[0]
  if a < b
    s.delete_at(0)
  elsif a > b
    t.delete_at(0)
  else
    s.delete_at(0)
    t.delete_at(0)
    count += 1
  end
end
p count