#include <bits/stdc++.h>
using namespace std;
int n, num1, num2;
int p[105], vis[105], vis1[105];
int main() {
  cin >> n;
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n / 2; i++) {
    cin >> p[i];
    vis[p[i]] = 1;
  }
  sort(p, p + n / 2);
  memcpy(vis1, vis, sizeof(vis));
  int ans = 0, ans1 = 0;
  for (int i = 1; i <= n / 2; i++) {
    if (p[i] % 2 == 1) {
      int t;
      for (int j = 1; p[i] + j <= n; j += 2) {
        if (vis[p[i] + j] == 0) {
          vis[p[i] + j] = 1;
          t = j;
          break;
        }
      }
      for (int j = 1; p[i] - j >= 1; j += 2) {
        if (vis[p[i] - j] == 0) {
          vis[p[i] - j] = 1;
          t = min(t, j);
          break;
        }
      }
      ans += t;
    }
  }
  memcpy(vis, vis1, sizeof(vis1));
  for (int i = 1; i <= n / 2; i++) {
    if (p[i] % 2 == 0) {
      int t;
      for (int j = 1; p[i] + j <= n; j += 2) {
        if (vis[p[i] + j] == 0) {
          vis[p[i] + j] = 1;
          t = j;
          break;
        }
      }
      for (int j = 1; p[i] - j >= 1; j += 2) {
        if (vis[p[i] - j] == 0) {
          vis[p[i] - j] = 1;
          t = min(t, j);
          break;
        }
      }
      ans1 += t;
    }
  }
  cout << min(ans, ans1) << endl;
  return 0;
}
