#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
int main() {
	int *S, n, i = 0,j;
	unsigned long long cnt = 0,s;
	scanf("%d", &n);
	S = (int*)calloc(n + 21, sizeof(int));
	for (i = 0; i < n; i++) {
		scanf("%d", S + i);
	}
	for (i = 0; i < n - 1; i++) {
		for (j = i + 1; j < n; j++) {
			if (*(S + i) > *(S + j))cnt++;
		}
	}
	printf("%lld\n", cnt);
	free(S);

	return 0;
}