#include <bits/stdc++.h>
using namespace std;
int a[105], vis[105];
int main() {
  int n, x, ans = 0;
  cin >> n;
  for (int i = 1; i <= n / 2; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + 1 + n / 2);
  for (int i = 1; i <= n / 2; i++) {
    if (a[i] % 2 == 0) {
      if (!vis[a[i]])
        vis[a[i]] = 1;
      else {
        for (int j = 2;; j += 2) {
          int flag = 0;
          int t = a[i] - j;
          if (t > 0) {
            flag = 1;
            if (vis[t] == 0) {
              ans += j;
              vis[t] = 1;
              break;
            }
          }
          t = a[i] + j;
          if (t <= n) {
            flag = 1;
            if (vis[t] == 0) {
              ans += j;
              vis[t] = 1;
              break;
            }
          }
          if (flag == 0) break;
        }
      }
    } else {
      for (int j = 1;; j += 2) {
        int flag = 0;
        int t = a[i] - j;
        if (t > 0) {
          flag = 1;
          if (vis[t] == 0) {
            ans += j;
            vis[t] = 1;
            break;
          }
        }
        t = a[i] + j;
        if (t <= n) {
          flag = 1;
          if (vis[t] == 0) {
            ans += j;
            vis[t] = 1;
            break;
          }
        }
        if (flag == 0) break;
      }
    }
  }
  int minn = 100000000;
  memset(vis, 0, sizeof(vis));
  minn = min(minn, ans);
  ans = 0;
  for (int i = 1; i <= n / 2; i++) {
    if (a[i] % 2 == 1) {
      if (vis[a[i]] == 0)
        vis[a[i]] = 1;
      else {
        for (int j = 0;; j += 2) {
          int flag = 0;
          int t = a[i] - j;
          if (t > 0) {
            flag = 1;
            if (vis[t] == 0) {
              ans += j;
              vis[t] = 1;
              break;
            }
          }
          t = a[i] + j;
          if (t <= n) {
            flag = 1;
            if (vis[t] == 0) {
              ans += j;
              vis[t] = 1;
              break;
            }
          }
          if (flag == 0) break;
        }
      }
    } else {
      for (int j = 1;; j += 2) {
        int flag = 0;
        int t = a[i] - j;
        if (t > 0) {
          flag = 1;
          if (vis[t] == 0) {
            ans += j;
            vis[t] = 1;
            break;
          }
        }
        t = a[i] + j;
        if (t <= n) {
          flag = 1;
          if (vis[t] == 0) {
            ans += j;
            vis[t] = 1;
            break;
          }
        }
        if (flag == 0) break;
      }
    }
  }
  minn = min(minn, ans);
  printf("%d\n", minn);
  return 0;
}
