def rotated_array_search(input_list, number):
    """
    Find the index by searching in a rotated sorted array
    Args:
       input_list(array), number(int): Input array to search and the target
    Returns:
       int: Index or -1
    """

    #Return -1 if the case input list is empty
    if len(input_list) == 0:
        return -1

    if len(input_list) == 1 and input_list[0] != number:
        return -1


    #initial the left index and right index
    left_index = 0
    right_index = len(input_list) - 1
    
    
    while left_index + 1 < right_index:
        mid_index = (left_index + right_index) //2
        mid_element = input_list[mid_index]

        

        # return the middle index if the number is equal to the middle element
        if mid_element == number:
            return mid_index

        

        # Condition 1: left_element < mid_element < right_element

        if input_list[left_index] < mid_element < input_list[right_index]:

            if number > mid_element:

                left_index = mid_index

            else:

                right_index = mid_index

        # Condition 2: middle_element > left_element and middle_element > right_element

        elif mid_element > input_list[left_index] and mid_element > input_list[right_index]:

            if input_list[left_index] <= number < mid_element:

                right_index = mid_index

            else:

                left_index = mid_index

        # Condition 3: middle_element < left_element and middle_element < right element

        elif mid_element < input_list[left_index] and mid_element < input_list[right_index]:

            if mid_element < number <= input_list[right_index]:

                left_index = mid_index

            else:

                right_index = mid_index
        

    if input_list[left_index] == number:

        return left_index
       
    elif input_list[right_index] == number:

        return right_index
    else:
        return -1