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

int main(int argc, char *argv[])
{
  int n, i, j;
  int *A;
  int inv;

  scanf("%d", &n);
  A = (int *)malloc(sizeof(int) * n);
  for (i = 0; i < n; i++) scanf("%d", &A[i]);

  inv = 0;
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      if (A[i] > A[j]) inv++;
    }
  }

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

  return 0;
}