#include <bits/stdc++.h>
int sort(int a[], int n) {
  int i, j, k = 0, t;
  for (i = 0; i < n; i++) {
    for (j = n - 1; j > i; j--) {
      if (a[j] < a[j - 1]) {
        t = a[j];
        a[j] = a[j - 1];
        a[j - 1] = t;
        k++;
      }
    }
  }
  return k;
}
int main(void) {
  int n, a[100], i, count;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    count = sort(a, n);
    printf("%d\n", count);
  }
  return 0;
}
