#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, a[3001], ans = 0, ass = 0;
  map<long long int, long long int> mp;
  map<long long int, long long int> kp;
  cin >> n;
  for (long long int i = 1; i <= n / 2; i++) {
    cin >> a[i];
    mp[a[i]] = 1;
    kp[a[i]] = 1;
  }
  long long int temp = 3001, temp1 = 3001;
  for (long long int i = 1; i <= n / 2; i++) {
    if (a[i] % 2 == 1) {
      long long int c = a[i];
      c++;
      while (mp[c] != 0 && c <= n) {
        c = c + 2;
      }
      if (mp[c] == 0) {
        temp = c - a[i];
        temp1 = c;
      }
      c = a[i];
      c--;
      while (mp[c] != 0 && c >= 1) {
        c = c - 2;
      }
      if (mp[c] == 0 && c >= 1) {
        if (temp > a[i] - c) {
          temp = a[i] - c;
          temp1 = c;
        }
      }
      ans += temp;
      mp[temp1] = 1;
    }
  }
  temp = 3001;
  temp1 = 3001;
  for (long long int i = 1; i <= n / 2; i++) {
    if (a[i] % 2 == 0) {
      long long int c = a[i];
      c++;
      while (kp[c] != 0 && c <= n) {
        c = c + 2;
      }
      if (mp[c] == 0) {
        temp = c - a[i];
        temp1 = c;
      }
      c = a[i];
      c--;
      while (kp[c] != 0 && c >= 1) {
        c = c - 2;
      }
      if (kp[c] == 0 && c >= 1) {
        if (temp > a[i] - c) {
          temp = a[i] - c;
          temp1 = c;
        }
      }
      ass += temp;
      kp[temp1] = 1;
    }
  }
  cout << min(ans, ass) << endl;
  return 0;
}
