n = gets.chomp.to_i
s = gets.chomp.split(" ")
q = gets.chomp.to_i
t = gets.chomp.split(" ")

count = 0
q.times do |i|
  s.each do |ss|
    if t[i] == ss
      count += 1
      break
      # include? true or false can be the solution
    end
  end
end

puts count
