Help me in solving DAA014 problem

My issue

Time Limit Exceeded

My code

# cook your dish here
def find_inversion_count(arr, n):
    inv_count = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if arr[i] > arr[j]:
                inv_count += 1
    return inv_count % (10**9 + 7)

t = int(input())
for _ in range(t):
    n = int(input())
    arr = list(map(int, input().split()))
    print(find_inversion_count(arr, n))

Learning course: Analysis and Design of Algorithms
Problem Link: Inversion Count in Analysis and Design of Algorithms