input: from typing import List
  
  def duplicate_numbers_xor(nums: List[int]) -> int:
      """
      You are given an array nums, where each number in the array appears either once or twice.
      Return the bitwise XOR of all the numbers that appear twice in the array, or 0 if no number appears twice.
  
      Examples:
      >>> nums = [1,2,1,3]
      1
      >>> nums = [1,2,3]
      0
  
      Constraints:
      1 <= nums.length <= 50
      1 <= nums[i] <= 50
      Each number in nums appears either once or twice.
      """
  
output: 
      xor_result = 0
      num_count = {}
      
      for num in nums:
          if num in num_count:
              xor_result ^= num
          else:
              num_count[num] = 1
      
      return xor_result
  