#include <stdio.h>
#include <stdlib.h>
//void show(unsigned *A, unsigned s) {
//  while(s--) fprintf(stdout,"%d ",*A++);
//  fputc('\n',stdout);
//}
int main(void)
{
	unsigned size, *Array, *end, *top, *cur,
	         count =0, swap;
	fscanf(stdin,"%u",&size);
	Array = (unsigned *)malloc(sizeof(unsigned) * size);
	end = Array + size;
	cur = Array;
	while (cur < end) fscanf(stdin,"%d",cur++);
	
	top = Array;
	while(top < end) {
		cur = top;
		while (cur < end -1)
		{
			if (*cur > *(cur +1)) {
				count += 1;
				swap = *cur;
				*cur = *(cur+1);
				*(cur+1) = swap;
//				show(Array,size);
			}
			cur += 1;
		}
		end -= 1;
	}
	
	end = Array + size;
//	show(Array,size);
	
	fprintf(stdout,"%d\n",count);
	
	
	
	free(Array);
	return 0;
}