Question: 
Write a python function to count the number of rotations required to generate a sorted array.


Model's Code:
def count_Rotation(arr, n):
    low = 0
    high = n - 1

    while low <= high:
        if arr[low] <= arr[high]:
            return low
        mid = (low + high) // 2
        next = (mid + 1) % n
        prev = (mid - 1 + n) % n
        if arr[mid] <= arr[next] and arr[mid] <= arr[prev]:
            return mid
        elif arr[mid] >= arr[low]:
            low = mid + 1
        else:
            high = mid - 1
    return 0



Sample Correct Code:
def count_Rotation(arr,n):   
    for i in range (1,n): 
        if (arr[i] < arr[i - 1]): 
            return i  
    return 0


Asserts:
assert count_Rotation([3,2,1],3) == 1
assert count_Rotation([4,5,1,2,3],5) == 2
assert count_Rotation([7,8,9,1,2,3],6) == 3


Tests:
Test 1 of 3: FAIL: AssertionError()

Test 802 of 974: 609/802 (75.93516209476309%): failed