def binary_search(arr, target)
  left = 0
  right = arr.size

  while left < right
    mid = (left + right) / 2

    if arr[mid] == target
      return mid
    elsif target < arr[mid]
      right = mid
    else
      left = mid + 1
    end
  end

  nil
end

gets
s = gets.split.map(&:to_i)

gets
t = gets.split.map(&:to_i)

count = 0

t.each do |n|
  count += 1 if binary_search(s, n)
end

puts count