input: from typing import List
  from functools import reduce
  import math
  def minimize_length_of_array(nums: List[int]) -> int:
      """
      You have a 0-indexed integer array nums with positive integers.
  
      The task is to reduce the length of nums as much as possible by repeatedly performing the following operations any number of times (including zero):
  
      Choose two different indices i and j in nums where both 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.
  
      The function should return an integer representing the smallest possible length of nums after performing the operations as described.
  
      Examples:
      >>> nums = [1,4,3,1]
      1
      >>> nums = [5,5,5,10,5]
      2
      >>> nums = [2,3,4]
      1
  
      Constraints:
      1 <= nums.length <= 10^5
      1 <= nums[i] <= 10^9
      """
output:     
      def gcd(a, b):
          while b:
              a, b = b, a % b
          return a
  
      def reduce_by_gcd(arr):
          return reduce(gcd, arr)
  
      while len(nums) > 1:
          nums = [reduce_by_gcd(nums)]
      
      return len(nums)
  