#include <stdio.h>
#include <stdlib.h>
int main(void)
{
	unsigned size, *Array, *end, *Left, *Right,
	         count =0;
	fscanf(stdin,"%u",&size);
	Array = (unsigned *)malloc(sizeof(unsigned) * size);
	end = Array + size;
	Left = Array;
	while(Left < end) fscanf(stdin,"%u",Left++);
	
	for (Left = Array; Left < end -1; Left += 1) 
		for(Right = Left +1; Right < end; Right += 1)
			if (*Left > *Right) count++;

	free(Array);
	fprintf(stdout,"%u\n",count);
	return 0;
}