#include <stdio.h>
int main (){
  int n;
  int i,j;
  int a[200000];
  int count=0;
  int tmp;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);

  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(a[i]>a[j])count++;
    }
  }
  printf("%d\n",count);
  return 0;
}