#include <stdio.h>

int count = 0;

int main(){
  int S[200000], n, i, j, temp;

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

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

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