#include <stdio.h>
#define N 200001

int n, A[N];
int cnt = 0;

void swap(int *x, int *y){
    int temp;

    temp = *y;
    *y = *x;
    *x = temp;
}

void bubbleSort(){

    int i, j;

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

int main() {

    int i;

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

    bubbleSort();

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

    return 0;
}