






"""simple docstring"""


def        UpperCAmelCase      (					a__ ):





						'''simple docstring'''






						lowerCAmelCase   :Optional[Any]						=			len(a__ )
						lowerCAmelCase   :Tuple						=			len(matrix[0] )
						lowerCAmelCase   :List[Any]						=			min(a__     ,      a__ )

						for row in range(a__ ):
												# Check if diagonal element is not zero
												if matrix[row][row] != 0:
																		# Eliminate all the elements below the diagonal
																		for col in range(row + 1     ,      a__ ):
																								lowerCAmelCase   :Dict						=			matrix[col][row] / matrix[row][row]
																								for i in range(a__     ,      a__ ):
																														matrix[col][i] -= multiplier * matrix[row][i]
												else:
																		# Find a non-zero diagonal element to swap rows
																		lowerCAmelCase   :Union[str, Any]						=			True
																		for i in range(row + 1     ,      a__ ):
																								if matrix[i][row] != 0:
																														lowerCAmelCase	, lowerCAmelCase   :Optional[Any]						=			matrix[i], matrix[row]
																														lowerCAmelCase   :Dict						=			False
																														break
																		if reduce:
																								rank -= 1
																								for i in range(a__ ):
																														lowerCAmelCase   :Optional[int]						=			matrix[i][rank]

            # Reduce the row pointer by one to stay on the same row
																		row -= 1

						return rank


if __name__ == "__main__":
		import doctest

		doctest.testmod()







"""simple docstring"""


from math import loga


def        UpperCAmelCase      (					a__ ):





						'''simple docstring'''






						if a < 0:
												raise ValueError('Input value must be a positive integer' )
						elif isinstance(a__     ,      a__ ):
												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()