
    Given a patient's health assessment containing both protective factors (negative values) and risk factors (positive values), rearrange the n most recent health indicators so that all protective factors are listed before risk factors while preserving their relative chronological order within each category. This reorganization will help clinicians quickly identify a patient's primary protective measures before examining risk factors, maintaining the temporal significance of when each factor was documented in the patient's history.
    

    
def re_arrange_array(arr, n):
    """
    Given a patient's health assessment containing both protective factors (negative values) and risk factors (positive values), rearrange the n most recent health indicators so that all protective factors are listed before risk factors while preserving their relative chronological order within each category. This reorganization will help clinicians quickly identify a patient's primary protective measures before examining risk factors, maintaining the temporal significance of when each factor was documented in the patient's history.
    

    """
def re_arrange_array(arr, n):
    """
    Given a patient's health assessment containing both protective factors (negative values) and risk factors (positive values), rearrange the n most recent health indicators so that all protective factors are listed before risk factors while preserving their relative chronological order within each category. This reorganization will help clinicians quickly identify a patient's primary protective measures before examining risk factors, maintaining the temporal significance of when each factor was documented in the patient's history.
    

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