class     lowerCAmelCase_     :  # Public class to implement a graph







							def __init__(   self      :     Dict ,			_A      :     Optional[int] ,			_A      :     List[str] ,			_A      :     Any		):
												_UpperCamelCase			     =     row
												_UpperCamelCase			     =     col
												_UpperCamelCase			     =     graph







							def  UpperCamelCase_						(   self      :     Optional[Any] ,			_A      :     List[Any] ,			_A      :     List[Any] ,			_A      :     Union[str, Any]		):
												return (
												    0 <= i < self.ROW
												    and 0 <= j < self.COL
												    and not visited[i][j]
												    and self.graph[i][j]
												)







							def  UpperCamelCase_						(   self      :     Optional[int] ,			_A      :     List[Any] ,			_A      :     List[Any] ,			_A      :     Tuple		):
												# Checking all 8 elements surrounding nth element
												_UpperCamelCase			     =     [-1, -1, -1, 0, 0, 1, 1, 1]  # Coordinate order
												_UpperCamelCase			     =     [-1, 0, 1, -1, 1, -1, 0, 1]
												_UpperCamelCase			     =     True  # Make those cells visited
												for k in range(8		):
																	if self.is_safe(i + row_nbr[k] ,			j + col_nbr[k] ,			UpperCamelCase_		):
																						self.diffs(i + row_nbr[k] ,			j + col_nbr[k] ,			UpperCamelCase_		)







							def  UpperCamelCase_						(   self      :     int		):  # And finally, count all islands.
												_UpperCamelCase			     =     [[False for j in range(self.COL		)] for i in range(self.ROW		)]
												_UpperCamelCase			     =     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(UpperCamelCase_ ,			UpperCamelCase_ ,			UpperCamelCase_		)
																											count += 1
												return count







'''simple docstring'''




from math import loga




def 						__lowerCamelCase			(	UpperCAmelCase_							)   ->int:
	if a < 0:
		raise ValueError('Input value must be a positive integer'							)
	elif isinstance(UpperCAmelCase_					,				UpperCAmelCase_							):
		raise TypeError('Input value must be a \'int\' type'							)
	return 0 if (a == 0) else int(loga(a & -a							)							)


if __name__ == "__main__":
			import doctest

			doctest.testmod()



