#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[101], prr[101], i, freq = -1, cnt = 0, sumB = 0, sumW = 0, sumBR = 0,
                             sumWR = 0, sumWL = 0, sumBL = 0, j, mov, x;
  memset(arr, -1, sizeof(arr));
  memset(prr, -1, sizeof(arr));
  for (i = 1; i <= n / 2; ++i) {
    cin >> x;
    arr[x] = 1;
    prr[x] = 1;
  }
  for (i = 1; i <= n - 1; i = i + 2) {
    if (arr[i] == 1) {
      mov = 0;
      for (j = i + 1; j <= n; j = j + 2) {
        if (arr[j] != 1) {
          mov = abs(j - i);
          arr[j] = 1;
          arr[i] = -1;
          break;
        }
      }
      sumBR += mov;
    }
  }
  for (i = n - 1; i >= 1; i = i - 2) {
    if (arr[i] == 1) {
      mov = 0;
      for (j = i - 1; j >= 2; j = j - 2) {
        if (arr[j] != 1) {
          mov = abs(j - i);
          arr[j] = 1;
          arr[i] = -1;
          break;
        }
      }
      sumBL += mov;
    }
  }
  sumB = sumBL + sumBR;
  for (i = 2; i <= n; i = i + 2) {
    if (prr[i] == 1) {
      mov = 0;
      for (j = i + 1; j <= n - 1; j = j + 2) {
        if (prr[j] != 1) {
          mov = abs(j - i);
          prr[j] = 1;
          prr[i] = -1;
          break;
        }
      }
      sumWR += mov;
    }
  }
  for (i = n; i >= 2; i = i - 2) {
    if (prr[i] == 1) {
      mov = 0;
      for (j = i - 1; j >= 1; j = j - 2) {
        if (prr[j] != 1) {
          mov = abs(j - i);
          prr[j] = 1;
          prr[i] = -1;
          break;
        }
      }
      sumWL += mov;
    }
  }
  sumW = sumWR + sumWL;
  cout << min(sumW, sumB);
}
