
    Given a list of investment risk scores for financial products in a client's portfolio, determine how many pairs of investments need to be rebalanced to align with the client's risk tolerance profile. An investment pair needs rebalancing when a higher-risk product appears before a lower-risk product in the portfolio sequence, and the total count of such pairs will indicate the extent of portfolio restructuring required.
    

    
def get_Inv_Count(arr):
    """
    Given a list of investment risk scores for financial products in a client's portfolio, determine how many pairs of investments need to be rebalanced to align with the client's risk tolerance profile. An investment pair needs rebalancing when a higher-risk product appears before a lower-risk product in the portfolio sequence, and the total count of such pairs will indicate the extent of portfolio restructuring required.
    

    """
def get_Inv_Count(arr):
    """
    Given a list of investment risk scores for financial products in a client's portfolio, determine how many pairs of investments need to be rebalanced to align with the client's risk tolerance profile. An investment pair needs rebalancing when a higher-risk product appears before a lower-risk product in the portfolio sequence, and the total count of such pairs will indicate the extent of portfolio restructuring required.
    

    """
    inv_count = 0
    for i in range(len(arr)):
        for j in range(i + 1, len(arr)):
            if arr[i] > arr[j]:
                inv_count += 1
    return inv_count