#include <bits/stdc++.h>
int main() {
  int n, i, j;
  scanf("%d", &n);
  int arr[n / 2];
  for (i = 0; i < n / 2; i++) {
    scanf("%d", &arr[i]);
  }
  int count = n, yes = n - 1, temp, count1 = 0, count2 = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) {
      if (arr[j] > arr[j + 1]) {
        temp = arr[j];
        arr[j] = arr[j + 1];
        arr[j + 1] = temp;
      }
    }
  }
  for (i = n / 2 - 1; i >= 0; i--) {
    temp = arr[i];
    while (temp != count) {
      if (temp > count) {
        temp--;
        count1++;
      } else {
        temp++;
        count1++;
      }
    }
    count -= 2;
  }
  for (i = n / 2 - 1; i >= 0; i--) {
    temp = arr[i];
    while (temp != yes) {
      if (temp > yes) {
        temp--;
        count2++;
      } else {
        temp++;
        count2++;
      }
    }
    yes -= 2;
  }
  count1 < count2 ? printf("%d", count1) : printf("%d", count2);
  return 0;
}
