n = int(input())
mylist = []
bs = 0
for i in range(n):
    ww = int(input())
    mylist.append(ww)
for j in range(len(mylist)):
    for i in range(len(mylist)-j):
        s = i+1
        if int(mylist[i]) >= int(mylist[s]):
            bs += 1
print(int(bs))            
               