#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	int n,m;
	cin >>n;
	vector<pair<int,int> > a(n);
	for(int i=0;i<n;i++){
		cin >>m;
		a[i] = make_pair(m,i);
	}
	sort(a.begin(),a.end());
	int ans=0;
	for(int j=0;j<n;j=j+2){
		if(a[j].second%2){
			ans+=1;
		}
	}
	cout << ans <<endl;
	return 0;
}