def number_of_inversions(array)
	count = 0
	last_index = array.size - 1
	(0...last_index).each do |i|
		last_index.downto(i + 1) do |j|
			count += 1 if array[i] > array[j]
		end
	end
	count
end

n = STDIN.gets.to_i
array = STDIN.gets.split[0...n].map(&:to_i)
puts number_of_inversions(array)