#include <bits/stdc++.h>
int a[1000], n;
using namespace std;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n / 2; i++) {
    int x;
    scanf("%d", &x);
    a[x] = 1;
  }
  int cnt = 0;
  int ans1 = 0, ans2 = 0;
  for (int i = 1; i <= n / 2; i++) {
    cnt = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j] == 1) cnt++;
      if (cnt == i) {
        ans1 += max(j - 2 * i + 1, 2 * i - 1 - j);
        break;
      }
    }
  }
  for (int i = 1; i <= n / 2; i++) {
    cnt = 0;
    for (int j = 1; j <= n; j++) {
      if (a[j] == 1) cnt++;
      if (cnt == i) {
        ans2 += max(j - 2 * i, 2 * i - j);
        break;
      }
    }
  }
  printf("%d", min(ans1, ans2));
  return 0;
}
