4.times do
  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}

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

  puts C
  break
end

