#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
#define F first
#define S second
int n,ans;
P a[100005];
int main(void){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        cin>>a[i].F;
        a[i].S=i;
    }
    sort(a,a+n);
    for(int i=0;i<n;i+=2)if(a[i].S%2)ans++;
    printf("%d\n",ans);
}
