#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<array>
#include<random>
#include<string>
#include<time.h>
#include<cstring>
#include<set>
#include<cmath>
#include<queue>
#define int long long
#define endl '\n'
#define F first
#define S second
#define sz size()
#define ln cout<<'\n'
#define B begin()
#define pb push_back
#define D end()
#define pii pair<int,int>
using namespace std;
const int N=3e6+10;
const int mod=1e9;
void solve()
{
int n;cin>>n;
vector<int>a(n+1);
for(int i=1;i<=n;i++) cin>>a[i];
int ans=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(a[i]<a[j])
{
swap(a[i],a[j]);
ans++;
}
}
}
return ans;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int tc=1;
//cin>>tc;
while(tc--)
{
solve();
}
//cout<<"dafc";
return 0;
}