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



count = 0
t.each do |tt|
  left = 0
  right = n - 1
  middle = (left + right)/2
  while true do
    if s[middle] == tt
      count += 1
      break
    elsif s[middle] > tt
      right = middle
      if (right - left) == 1
        if s[left] == tt || s[right] == tt
          count += 1
          break
        else
          break
        end
      end
      middle = (left + right)/2
    else
      left = middle
      if (right - left) == 1
        if s[left] == tt || s[right] == tt
          count += 1
          break
        else
          break
        end
      end
      middle = (left + right)/2
    end
  end
end

puts count
