def include_number?(array, key, length = nil)
  length ||= array.length
  left = 0
  right = length
  while left < right
    mid = (left + right) / 2
     if array[mid] == key
      return true
    elsif key < array[mid]
      right = mid
    else
      left = mid + 1
    end
  end
  false
end

length = gets.to_i
array = gets.split(" ").map(&:to_i)
gets  
keys =  gets.split(" ").map(&:to_i)
count = 0
keys.each do |key|
  count += 1 if include_number?(array, key)
end
puts count
