#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int arr[n + 1];
  int i;
  bool cond[n + 1];
  for (i = 0; i <= n; i++) cond[i] = false;
  int t = (n / 2);
  for (i = 1; i <= t; i++) {
    cin >> arr[i];
    cond[arr[i]] = true;
  }
  int mx1 = 0;
  int mx2 = 0;
  int j;
  int tmp = 100000;
  int req;
  for (i = 1; i <= t; i++) {
    tmp = 100000;
    if (arr[i] % 2 != 0)
      continue;
    else {
      for (j = 1; j <= n; j++) {
        if (j % 2 != 0 && cond[j] == false && tmp > abs(arr[i] - j)) {
          req = j;
          tmp = abs(arr[i] - j);
        }
      }
    }
    cond[req] = true;
    if (tmp == 100000) tmp = 0;
    mx1 += tmp;
  }
  for (i = 0; i <= n; i++) cond[i] = false;
  for (i = 1; i <= t; i++) cond[arr[i]] = true;
  for (i = 1; i <= t; i++) {
    tmp = 100000;
    if (arr[i] % 2 == 0)
      continue;
    else {
      for (j = 1; j <= n; j++) {
        if (j % 2 == 0 && cond[j] == false && tmp > abs(arr[i] - j)) {
          req = j;
          tmp = abs(arr[i] - j);
        }
      }
    }
    cond[req] = true;
    if (tmp == 100000) tmp = 0;
    mx2 += tmp;
  }
  cout << min(mx1, mx2);
  return 0;
}
