input: from typing import List
  from functools import reduce
  import math
  def reduce_array_length(nums: List[int]) -> int:
      """
      Given a list of positive integers, the goal is to reduce its size by applying the following operation multiple times:
  
      Choose two distinct indices i and j from nums where both are positive.
  
      Append the remainder of nums[i] divided by nums[j] to the end of nums.
  
      Remove the elements at indices i and j from nums.
  
      The function returns the smallest size of nums that can be achieved.
  
      Examples:
      >>> nums = [1,4,3,1]
      1
      >>> nums = [5,5,5,10,5]
      2
      >>> nums = [2,3,4]
      1
  
      Constraints:
      1 <= len(nums) <= 100000
      1 <= nums[i] <= 1000000000
      """
output:     
      while len(nums) > 1:
          # Find two elements to process
          i, j = None, None
          for x in range(len(nums)):
              for y in range(x + 1, len(nums)):
                  if nums[x] > 0 and nums[y] > 0:
                      i, j = x, y
                      break
              if i is not None:
                  break
  
          # If no such pair exists, break the loop
          if i is None or j is None:
              break
          
          # Append the remainder and remove the chosen elements
          nums.append(nums[i] % nums[j])
          nums[i], nums[j] = -1, -1
          nums = [num for num in nums if num != -1]
  
      return len(nums)
  