n=int(input())
lis=[]
for b in range(n):
    a=int(input())
    lis.append(a)
c=int(0)
for i in range(n):
    b=len(lis)-c
    for j in range(n-b-1):
        if lis[j]<lis[j+1]:
            lis[j],lis[j+1]=lis[j+1],lis[j];c=c+int(1)
        else:
            c=c+int(0)
    

print(c)
    