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

int main()
{
//	freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,temp=0,ans=0;
    cin>>n;
    int arr[n/2+1];
    int a[n+1]={0};
    int b=0,w=0;
    for(int i=0;i<n/2;i++)
    {
    	cin>>arr[i];
    	a[arr[i]] = 1;
    	if(i%2==0)
    		b++;
    	else
    		w++;
    }
    int j=0;
    for(int i=0;i<n;i=i+2)
    {
    	temp = temp + abs(arr[j] - (i+1));
    	j++;
    }
    j=0;
    for(int i=1;i<=n;i=i+2)
    {
    	ans = ans + abs(arr[j] - (i+1));
    	j++;
    }
    if(temp<ans)
    	cout<<temp<<endl;
    else
    	cout<<ans<<endl;
    
    

    return 0;
}