
    Design a system that analyzes student performance data where negative values represent risk factors and positive values represent protective factors, and reorganizes the most recent n indicators to group all risk factors before protective factors while maintaining their chronological sequence within each category. The system must process an array of student performance metrics and an integer n specifying the number of recent indicators to analyze, ensuring that the temporal relationship between indicators of the same type (risk or protective) remains unchanged.
    

    
def re_arrange_array(arr, n):
    """
    Design a system that analyzes student performance data where negative values represent risk factors and positive values represent protective factors, and reorganizes the most recent n indicators to group all risk factors before protective factors while maintaining their chronological sequence within each category. The system must process an array of student performance metrics and an integer n specifying the number of recent indicators to analyze, ensuring that the temporal relationship between indicators of the same type (risk or protective) remains unchanged.
    

    """
def re_arrange_array(arr, n):
    """
    Design a system that analyzes student performance data where negative values represent risk factors and positive values represent protective factors, and reorganizes the most recent n indicators to group all risk factors before protective factors while maintaining their chronological sequence within each category. The system must process an array of student performance metrics and an integer n specifying the number of recent indicators to analyze, ensuring that the temporal relationship between indicators of the same type (risk or protective) remains unchanged.
    

    """
    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