


'''simple docstring'''
class 			lowerCamelCase_   :  # Public class to implement a graph






      def __init__(					self				:    Optional[Any]						,						_A				:    int						,						_A				:    int						,						_A				:    list[list[bool]] ):


          '''simple docstring'''


          UpperCAmelCase__			:		Union[str, Any]													=				row
          UpperCAmelCase__			:		Dict													=				col
          UpperCAmelCase__			:		Any													=				graph






      def lowercase_							(					self				:    int						,						_A				:    int						,						_A				:    int						,						_A				:    list[list[bool]] ):


          '''simple docstring'''


          return (
              0 <= i < self.ROW
              and 0 <= j < self.COL
              and not visited[i][j]
              and self.graph[i][j]
          )






      def lowercase_							(					self				:    List[str]						,						_A				:    int						,						_A				:    int						,						_A				:    list[list[bool]] ):


          '''simple docstring'''


          UpperCAmelCase__			:		Any													=				[-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
          UpperCAmelCase__			:		str													=				[-1, 0, 1, -1, 1, -1, 0, 1]
          UpperCAmelCase__			:		Union[str, Any]													=				True  # Make those cells visited
          for k in range(8 ):
              if self.is_safe(i + row_nbr[k]						,						j + col_nbr[k]						,						_A ):
                  self.diffs(i + row_nbr[k]						,						j + col_nbr[k]						,						_A )






      def lowercase_							(					self				:    Any ):  # And finally, count all islands.


          '''simple docstring'''


          UpperCAmelCase__			:		Any													=				[[False for j in range(self.COL )] for i in range(self.ROW )]
          UpperCAmelCase__			:		int													=				0
          for i in range(self.ROW ):
              for j in range(self.COL ):
                  if visited[i][j] is False and self.graph[i][j] == 1:
                      self.diffs(_A						,						_A						,						_A )
                      count += 1
          return count




'''simple docstring'''
def 					a__       (					lowerCAmelCase__						)    ->	int:
    if a < 0:
        raise ValueError('''Input value must be a positive integer'''						)
    elif isinstance(lowerCAmelCase__  ,					lowerCAmelCase__						):
        raise TypeError('''Input value must be a \'int\' type'''						)
    return bin(lowerCAmelCase__						).count('''1'''						)


if __name__ == "__main__":
  import doctest

  doctest.testmod()
