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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rFOR(i, a, b) for (int i = (a) - 1; i >= (b); --i)

#define ll  long long int
#define ull unsigned long long
#define fast      ios::sync_with_stdio(0);cin.tie(0);
typedef vector< long >  vl;
typedef vector< vl >  vvl;
typedef pair<long , long>  pl;
typedef vector<pl>  vpl;
typedef pair<int, pl>  ppl;
typedef vector<ll>  vll;
typedef pair<ll,ll>  lll;
#define go_t int t;cin>>t;while(t--)
#define pb         push_back
#define endl "\n"
#define all(v) v.begin(),v.end()

#define present(t, x) (t.find(x) != t.end())
#define ff first
#define ss second
#define MOD 1000000007
#define deb2(x, y)         cout <<#x<<"= "<<x<<" | "<<#y<<"= "<<y<< endl;
#define deb3(x, y, z)      cout <<#x<<"= "<<x<<" | "<<#y<<"= "<<y<<" | "<<#z<<"= "<<z<<endl;
#define deb4(a, b, c, d)   cout <<#a<<"= "<<a<<" | "<<#b<<"= "<<b<<" | "<<#c<<"= "<<c<<" | "<<#d<<"= "<<d<<endl;
#define deb5(a, b, c, d, e)cout <<#a<<"= "<<a<<" | "<<#b<<"= "<<b<<" | "<<#c<<"= "<<c<<" | "<<#d<<"= "<<d<<" | "<<#e<<"= "<<e<<endl;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};


#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree < int ,null_type ,less<int> ,rb_tree_tag ,  tree_order_statistics_node_update >

 
/**********************************************************/

int main(){
   //#ifndef ONLINE_JUDGE
    // freopen("input.txt", "r", stdin);
   //  freopen("output.txt", "w", stdout);
    //#endif 

fast 
long i,j,k,m,p,q;
ll sum=0;

long n;
cin >> n;
vl v(n);
vl even, odd;
set<long> e, o,ce,co;
sort(all(v));
for(i=0;i<n/2;i++){
    cin >> v[i];

    if(v[i]%2){
       
        odd.pb(v[i]);
    } else {
       
        even.pb(v[i]);
    }
}
for(i=1;i<=n;i++){
    if(i%2)
    o.insert(i);
    else 
    e.insert(i);
}

vl t1, t2;

ce=e;
co=o;
for(auto i: odd){
    o.erase(i);
}

vl te,to;

for(auto i: o){
    to.pb(i);
}

sort(all(to));

long mn =1e8;

long ans1=0, ans2=0;

for(i=0;i<even.size();i++){
    ans1+=abs(to[i]-even[i]);
}

mn = min(ans1, mn);

for(auto i: even){
    e.erase(i);
}

for(auto i : e){
    te.pb(i);
}

sort(all(te));

for(i=0;i<odd.size();i++){
    ans2+=abs(te[i]-odd[i]);
}

mn = min(mn, ans2);

cout << mn << endl;


}