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