
    Given a list of bus route performance metrics and a number of priority routes to analyze, reorganize the priority routes so that all underutilized routes (represented by negative values) are grouped before overcrowded routes (represented by positive values), while maintaining the original sequence within each category. This reorganization will help transportation planners quickly identify which routes need capacity reduction versus expansion, while preserving the relative priority levels within each category.
    

    
def re_arrange_array(arr, n):
    """
    Given a list of bus route performance metrics and a number of priority routes to analyze, reorganize the priority routes so that all underutilized routes (represented by negative values) are grouped before overcrowded routes (represented by positive values), while maintaining the original sequence within each category. This reorganization will help transportation planners quickly identify which routes need capacity reduction versus expansion, while preserving the relative priority levels within each category.
    

    """
def re_arrange_array(arr, n):
    """
    Given a list of bus route performance metrics and a number of priority routes to analyze, reorganize the priority routes so that all underutilized routes (represented by negative values) are grouped before overcrowded routes (represented by positive values), while maintaining the original sequence within each category. This reorganization will help transportation planners quickly identify which routes need capacity reduction versus expansion, while preserving the relative priority levels within each category.
    

    """
    j = 0
    for i in range(0, n):
        if arr[i] < 0:
            temp = arr[i]
            arr[i] = arr[j]
            arr[j] = temp
            j = j + 1
    return arr