#define _CRT_SECURE_NO_WARNINGS
#include <math.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main() {
int m, i, n, s = 0, temp, M = 0;
int a[10000];
cin >> n;
for (i = 0; i < n; i++) {
cin >> s;
a[i] = s;
}
for (int j = 0; j < n-1; j++)
{
for (m = n - 1; m > j; m--)
{
if (a[j] > a[j - 1])
{
temp = a[j];
a[j] = a[j - 1];
a[j - 1] = temp;
M++;
}
}
}
cout << M << endl;
return 0;
}