#yuki742 n=int(raw_input()) m=[] for i in xrange(n): m.append(int(raw_input())) res=0 for i in xrange(n): for j in xrange(i+1,n): if m[i]>=m[j]: res+=1 print res