#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
#include <set>
using namespace std;

#define ll long long

struct square {
	int x;
	int y;
};

bool cmp(struct square a, struct square b) {return a.x<b.x;}

class Myclass {
public:
	void process();	
};

void Myclass::process() {
//	freopen("in.txt","r",stdin);
	
	int n,p,temp1,cnt,cnt2,mn;
	int i,j,k;
	
	while(cin>>n) {
		int arr[n+2]={0};
		int mark[n+2]={0};
		int mark2[n+2]={0};
		
		for(i=0;i<n/2;i++) {
			cin>>arr[i];
			mark[arr[i]]=1;
			mark2[arr[i]]=1;
		}
				
		//black
		cnt=0;
		for(i=0;i<n/2;i++) {			
			temp1=arr[i];			
			if(mark[temp1]==1 && temp1%2==0) {			
				for(j=1;j<=n;) {					
					if(mark[j]==0) {
						//cout<<"j: "<<j<<endl;
						//cout<<"Inside"<<endl;
						cnt=cnt+abs(temp1-j);
						//cout<<"cnt: "<<cnt<<endl;
						mark[j]=1;
						mark[temp1]=0;
						break;
					}					
					j=j+2;
				}	
			}
		}
		
		//white
		cnt2=0;
		for(i=0;i<n/2;i++) {			
			temp1=arr[i];			
			if(mark2[temp1]==1 && temp1%2==1) {			
				for(j=2;j<=n;) {					
					if(mark2[j]==0) {
						//cout<<"j: "<<j<<endl;
						//cout<<"Inside"<<endl;
						cnt2=cnt2+abs(temp1-j);
						//cout<<"cnt: "<<cnt<<endl;
						mark2[j]=1;
						mark2[temp1]=0;
						break;
					}					
					j=j+2;
				}	
			}
		}
		//cout<<"cnt: "<<cnt<<endl;
		//cout<<"cnt2: "<<cnt2<<endl;
		mn=min(cnt,cnt2);
		cout<<mn<<endl;		
	}		
	
}
int main() {
	Myclass obj;
	obj.process();
	return 0;	
}