input: from typing import List
  
  def max_elements_in_set_after_removal(nums1: List[int], nums2: List[int]) -> int:
      """
      You are given two 0-indexed integer arrays nums1 and nums2 of even length n.
  
      You must remove n / 2 elements from nums1 and n / 2 elements from nums2. After the removals, you insert the remaining elements of nums1 and nums2 into a set s.
  
      Return the maximum possible size of the set s.
  
      Examples:
      >>> nums1 = [1,2,1,2], nums2 = [1,1,1,1]
      2
      >>> nums1 = [1,2,3,4,5,6], nums2 = [2,3,2,3,2,3]
      5
      >>> nums1 = [1,1,2,2,3,3], nums2 = [4,4,5,5,6,6]
      6
  
      Constraints:
      n == nums1.length == nums2.length
      1 <= n <= 2 * 10^4
      n is even.
      1 <= nums1[i], nums2[i] <= 10^9
      """
  
output: 
      n = len(nums1)
      half_n = n // 2
      
      nums1.sort()
      nums2.sort()
      
      # Remove the smallest half of nums1 and the largest half of nums2
      nums1_removed = nums1[:half_n]
      nums2_removed = nums2[half_n:]
      
      # Remaining elements in nums1 and nums2
      nums1_remaining = nums1[half_n:]
      nums2_remaining = nums2[:half_n]
      
      # Create a set with the remaining elements
      s = set(nums1_remaining + nums2_remaining)
      
      return len(s)
  