input: from typing import List 
  from functools import reduce 
  import math 
  
  def reduce_array_length(nums: List[int]) -> int: 
      """
      Given a 0-indexed integer array nums consisting of positive integers.
  
      The goal is to reduce the length of nums by performing the following actions any number of times (including zero):
  
      Choose two different indices i and j from nums, such that 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.
  
      Return an integer denoting the minimum possible length of nums after performing the action any number of times.
  
      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
  
      while len(nums) > 1:
          nums.sort()
          a = nums.pop()
          b = nums.pop()
          result = gcd(a, b)
          if result > 0:
              nums.append(result)
          else:
              break
  
      return len(nums)
  