def binary_search(arr, key)
  left = 0
  right = arr.size
  while left < right
    mid = (left + right) / 2
    return true if arr[mid] == key

    if key < arr[mid]
      right = mid
    else
      left = mid + 1
    end
  end
  false
end


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

puts t.map{|v| binary_search(s, v)}.count{|v| v}