#include <stdio.h>

#define N 200000

int main(){

  int i;
  int j;
  int n;
  int A[N];
  int tmp;
  int count = 0;

  scanf("%d",&n);

  for(i=0;i<n;i++){
  scanf("%d",&A[i]);
  }
  
 for(i=0;i<n-1;i++){
   for(j=1;j<n;j++){
     if(A[j]<A[j-1]){
        tmp = A[j];
       A[j] = A[j-1];
     A[j-1] = tmp;
       count++;
   }
  }
 }
 printf("%d\n",count);

 return 0;
}