/*
 * ????????????.c
 *
 *  Created on: 2016/03/17
 *      Author: Owner
 */


#include<stdio.h>
#include<stdlib.h>

//?????¬??????????????????????????\??????????????°?????????????±??????????????????°????????????
int main(){
	int *A;
	int N,i,Asub,flag;
	int cnt = 0;//????????????????????°?????°??????
	int t = 0;
	scanf("%d",&N);
	A = (int*)malloc(sizeof(int)*N);


    for(i=0;i<N;i++){
		 scanf("%d",&A[i]);
	}

    flag = 1;

    //??????????????????
	while(flag == 1){

	   flag = 0;
	   for(i=0;i<N-1-t;i++){
		   if(A[i]>A[i+1]){
			   cnt++;
			   Asub = A[i];//??\????????????
			   A[i] = A[i+1];
			   A[i+1] = Asub;
			   flag = 1;
		   }
	   }
	   t++;//?????????????????¨???????£???°???
     }

	printf("%d?\n",cnt);//?????°?????¨???
	return 0;
}