human
Count of rotations required to generate a sorted array | Function to return the count of rotations.
If array is not rotated.
Check if current element is greater than the next element.
The next element is the smallest.
Check if current element is smaller than it 's previous  element.
Current element is the smallest.
Check if current element is greater than lower bound.
The sequence is increasing so far Search for smallest element on the right subarray.
Smallest element lies on the left subarray.
Search for the smallest element on both subarrays.
Driver code"
Solution in Python:

=====
Can you provide a code to count of rotations required to generate a sorted array and the other steps required?
assistant
#Here is code to count of rotations required to generate a sorted array and the other steps required.
 def countRotation ( arr , low , high ) :
	if ( low > high ) :
		return 0
	mid = low + ( high - low ) // 2
	if ( mid < high and arr [ mid ] > arr [ mid + 1 ] ) :
		return mid + 1
	if ( mid > low and arr [ mid ] < arr [ mid - 1 ] ) :
		return mid
	if ( arr [ mid ] > arr [ low ] ) :
		return countRotation ( arr , mid + 1 , high )
	if ( arr [ mid ] < arr [ high ] ) :
		return countRotation ( arr , low , mid - 1 )
	else :
		rightIndex = countRotation ( arr , mid + 1 , high )
		leftIndex = countRotation ( arr , low , mid - 1 )
		if ( rightIndex == 0 ) :
			return leftIndex
		return rightIndex
if __name__ == ' _ _ main _ _ ' :
	arr1 = [ 4 , 5 , 1 , 2 , 3 ]
	N = len ( arr1 )
	print ( countRotation ( arr1 , 0 , N - 1 ) )