def insertion_sort(n, a, c): for i in range(n): flag = 0 for j in reversed(range(i)): if a[j] > a[j + 1]: a[j], a[j + 1] = a[j + 1], a[j] flag = 1 else: break if flag == 1: c += 1 return c N = int(input()) A = list(map(int, input().split())) count = 0 print(insertion_sort(N, A, count))