N = int(input())
g = input()
a = g.split()
res = []
def bSort(array):
length = len(array)
for i in range(length):
for j in range(0, length-i-1):
if array[j] > array[j+1]:
array[j], array[j+1] = array[j+1], array[j]
res.append(1)
bSort(a)
print(len(res))