#include <stdio.h>
#define N 200000
int bubblesort(int*);
int n;
int A[N];
int main(){
  int a,i;

  scanf("%d",&n);

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

  a = bubblesort(A);

  printf("%d\n",a);
  
  return 0;
  
}

int bubblesort(int *A){
  int count=0;
  int i,j,hozon;
  for(i=0;i<n;i++){
    for(j=n-1;j>=i+1;j--){
      if(A[j]<A[j-1]){
	hozon = A[j];
	A[j] = A[j-1];
	A[j-1] = hozon;
	count++;
      }
    }
  }
  return count;
}

