
    Design a fraud detection function that analyzes a customer's historical transaction sequence to identify suspicious spending patterns by counting pairs of transactions where a later transaction amount is unexpectedly smaller than an earlier one. Each such pair (called an inversion) could indicate potential account sharing or unauthorized access, and the total count of these inversions helps determine the overall risk level of recent account activity.
    

    
def get_Inv_Count(arr):
    """
    Design a fraud detection function that analyzes a customer's historical transaction sequence to identify suspicious spending patterns by counting pairs of transactions where a later transaction amount is unexpectedly smaller than an earlier one. Each such pair (called an inversion) could indicate potential account sharing or unauthorized access, and the total count of these inversions helps determine the overall risk level of recent account activity.
    

    """
def get_Inv_Count(arr):
    """
    Design a fraud detection function that analyzes a customer's historical transaction sequence to identify suspicious spending patterns by counting pairs of transactions where a later transaction amount is unexpectedly smaller than an earlier one. Each such pair (called an inversion) could indicate potential account sharing or unauthorized access, and the total count of these inversions helps determine the overall risk level of recent account activity.
    

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