n = gets.chomp.to_i
S = gets.chomp.split(" ").map(&:to_i)
q = gets.chomp.to_i
T = gets.chomp.split(" ").map(&:to_i)
sortS = S.sort{|a, b| a <=> b}

count = 0

T.each do |t|
  left = 0
  right = n
  loop do
    middle = (right+left) / 2
    break if right == left
    if t == sortS[middle]
      count += 1
      break
    elsif sortS[middle] < t
      left = middle + 1
    else t <sortS[middle]
      right = middle -1
    end
  end
end

puts count

