

class 						_A     :





  '''simple docstring'''



  def __init__(  self   ,SCREAMING_SNAKE_CASE_    ):

      '''simple docstring'''
      snake_case							:		Any        =		set_counts
      snake_case							:		Union[str, Any]        =		max(SCREAMING_SNAKE_CASE_    )
      snake_case							:		Optional[int]        =		len(SCREAMING_SNAKE_CASE_    )
      snake_case							:		Optional[Any]        =		[1] * num_sets
      snake_case							:		Optional[Any]        =		list(range(SCREAMING_SNAKE_CASE_    )    )





  def    snake_case_       (  self   ,SCREAMING_SNAKE_CASE_   ,SCREAMING_SNAKE_CASE_    ):

      '''simple docstring'''
      snake_case							:		Any        =		self.get_parent(SCREAMING_SNAKE_CASE_    )
      snake_case							:		Any        =		self.get_parent(SCREAMING_SNAKE_CASE_    )

      if src_parent == dst_parent:
          return False

      if self.ranks[dst_parent] >= self.ranks[src_parent]:
          self.set_counts[dst_parent] += self.set_counts[src_parent]
          snake_case							:		Any        =		0
          snake_case							:		List[str]        =		dst_parent
          if self.ranks[dst_parent] == self.ranks[src_parent]:
              self.ranks[dst_parent] += 1
          snake_case							:		str        =		self.set_counts[dst_parent]
      else:
          self.set_counts[src_parent] += self.set_counts[dst_parent]
          snake_case							:		List[Any]        =		0
          snake_case							:		List[str]        =		src_parent
          snake_case							:		Any        =		self.set_counts[src_parent]

      snake_case							:		List[str]        =		max(self.max_set   ,SCREAMING_SNAKE_CASE_    )
      return True





  def    snake_case_       (  self   ,SCREAMING_SNAKE_CASE_    ):

      '''simple docstring'''
      if self.parents[disj_set] == disj_set:
          return disj_set
      snake_case							:		str        =		self.get_parent(self.parents[disj_set]    )
      return self.parents[disj_set]





"""simple docstring"""



def 			_UpperCamelCase						(    _A   )     ->	int:





    """simple docstring"""

    if not isinstance(_A       ,   _A   ) or number < 0:
        raise ValueError("""Input must be a non-negative integer"""   )

    _UpperCAmelCase        = 0
    while number:
        # This way we arrive at next set bit (next 1) instead of looping
        # through each bit and checking for 1s hence the
        # loop won't run 32 times it will only run the number of `1` times
        number &= number - 1
        count += 1
    return count


if __name__ == "__main__":
 import doctest

 doctest.testmod()