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