def b_search(array, n)
  low = 0
  high = array.size
  while low <= high
    mid = (low + high) / 2
    if n == array[mid]
      return true
    elsif n > array[mid]
      low = mid + 1
    else
      high = mid - 1
    end
  end
  false
end

gets
s = gets.split.map(&:to_i)
gets
t = gets.split.map(&:to_i)
puts t.count { |n| b_search(s, n) }