#include<iostream>
#include<utility>
#include<algorithm>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;
typedef pair<int,int> p;

int main(){
	int n;
	cin>>n;
	p a[n];
	long long sum=0;
	rep(i,n){cin>>a[i].first;a[i].second=i;}
	sort(a,a+n);
	rep(i,n){
		if(i%2==0 && a[i].second%2==1)sum++;
	}
	cout<<sum<<endl;
	return 0;
}