#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;
int n, ans, u, d, ar[2][N];

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		if (i & 1)
			cin >> ar[1][d++];
		else
			cin >> ar[0][u++];
	}
	sort(ar[0], ar[0] + u);
	sort(ar[1], ar[1] + d);
	for (int i = 0; i < min(u, d); i++)
		if (ar[0][i] > ar[1][i])
			ans++;
	cout << ans;
}
