N=int(input()) s=list(map(int,input().split())) a=0 for i in range(N): for j in range(i,N): if s[j]<s[i]: a+=1 print(a)