#include <stdio.h>
#include <stdlib.h>

long count = 0;

void bubble_count(long *a, long n) {
  long i,j;
  for(i = 0; i < n-1; i++) {
    for(j = i+1; j < n; j++) {
      if(a[i] > a[j]) count++;
    }
  }
}

int main()
{
  long i,n,*a;
  scanf("%ld", &n);
  a = (long*)malloc(sizeof(long) * n);
  for (i = 0; i < n; i++) {
    scanf("%ld", a+i);
  }
  bubble_count(a,n);

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