n=int(input())
c=[]
s=0
for b in range(n):
    a=int(input())
    c.append(a)
for i in range(n):
    for j in range(n-i):
        if c[i]>c[j]:
            c[i],c[j]=c[j],c[i]
            s+=1
        elif c[i]==c[j]:
            c[i],c[j]=c[i],c[j]
print(s)