input: from typing import List
  from functools import reduce
  import math
  def minimize_length(nums: List[int]) -> int:
      """
      Given a 0-indexed array of positive integers nums, the goal is to minimize the array length by repeatedly performing operations as described:
  
      - Pick two different indices i and j in nums with nums[i] > 0 and nums[j] > 0.
      - Append the result of nums[i] % nums[j] to the end of nums.
      - Remove the elements at indices i and j from nums.
  
      This process can be repeated any number of times (including zero times).
  
      The function returns the minimum possible length of nums after performing these operations.
  
      Examples:
      >>> nums = [1,4,3,1]
      1
      >>> nums = [5,5,5,10,5]
      2
      >>> nums = [2,3,4]
      1
  
      Constraints:
      1 <= len(nums) <= 10^5
      1 <= nums[i] <= 10^9
      """
output:     while len(nums) > 1:
          nums.sort()
          a = nums.pop(0)
          b = nums.pop(0)
          if b % a != 0:
              nums.append(b % a)
      return len(nums)