#include<stdio.h>
int bubblesort(int,int*);
int main(){

  int i;
  int n;
  int count;

  scanf("%d",&n);
  int N[n];
  for(i=0;i<n;i++){
    scanf("%d",&N[i]);
  }
  count=bubblesort(n,N);
  printf("%d\n",count);
}
int bubblesort(int n,int *N){

  int i,j;
  int count=0;

  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(N[i]>N[j]){
	count++;
      }
    }
  }
  return count;
}

