#include <stdio.h>
int main(int argc, char const *argv[]) {

  int i,j;
  int num;
  scanf("%d",&num);
  int a[num];
  int count = 0;

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


  for( i = 0 ; i < num-1 ; i++ ){
    for( j = i+1 ; j < num ; j++ ){

      if( a[i] > a[j] )
        count++;

    }
  }

  printf("%d\n",count);


  return 0;
}