n = int(input())
a = []
a=input()
a = list(map(int,a.split()))
def BUBBLESORT(a):
    count = 0
    n = len(a)
    swapped = True
    while swapped != False:
        swapped = False
        count += 1
        for i in range(n-1):
            if a[i] > a[i+1]:
                a[i],a[i+1] = a[i+1],a[i]
                swapped = True
    return count
print(BUBBLESORT(a))
