#include <bits/stdc++.h>
using namespace std;
priority_queue<long long, vector<long long>, greater<long long> > pq;
char ar2[1000][1000];
bool vis[1000][1000] = {0};
int arr[100000];
map<char, int> mp;
int A[2 * 100000];
bitset<64> bt;
set<int> st;
int n, m;
int main() {
  int x1[10000] = {0}, x2[100000] = {0};
  cin >> n;
  for (int i = 1; i <= n / 2; i++) {
    int z;
    cin >> z;
    x1[z] = 1;
    x2[z] = 1;
  }
  int mx;
  int c = 0, c2 = 0;
  for (int i = 1; i <= n; i++) {
    if (i % 2 == 0) {
      if (x1[i] == 1) {
        if (i == n) {
          for (int j = n; j > 0; j--)
            if (x1[j] == 0 && j % 2 != 0) {
              x1[j] = 1, x1[i] = 0, c += abs(i - j);
              break;
            }
        } else {
          for (int j = 0; j <= n; j++)
            if (x1[j] == 0 && j % 2 != 0) {
              x1[j] = 1, x1[i] = 0, c += abs(j - i);
              break;
            }
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (i % 2 != 0) {
      if (x2[i] == 1) {
        if (i == n) {
          for (int j = i; j > 0; j--)
            if (x2[j] == 0 && j % 2 == 0) {
              x2[j] = 1, x2[i] = 0, c2 += abs(i - j);
              break;
            }
        } else {
          for (int j = 0; j <= n; j++)
            if (x2[j] == 0 && j % 2 == 0) {
              x2[j] = 1, x2[i] = 0, c2 += abs(j - i);
              break;
            }
        }
      }
    }
  }
  cout << c;
}
