#include <bits/stdc++.h>
using namespace std;
int main() {
  queue<int> qu;
  int n, i, a, sum1 = 0, sum2 = 0, t;
  scanf("%d", &n);
  for (i = 1; i <= n / 2; i++) {
    scanf("%d", &a);
    qu.push(a);
  }
  for (i = 1; i <= n; i = i + 2) {
    t = qu.front();
    sum1 += abs(i - t);
    qu.pop();
    qu.push(t);
  }
  for (i = 2; i <= n; i = i + 2) {
    t = qu.front();
    sum2 += abs(i - t);
    qu.pop();
  }
  if (sum1 < sum2)
    printf("%d\n", sum1);
  else
    printf("%d\n", sum2);
  return 0;
}
