#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 1;
const int mo = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long quickpow(long long a, long long b, long long mo) {
  long long ans = 1, pow = a;
  while (b) {
    if (b & 1) ans = pow * ans % mo;
    pow = pow * pow % mo;
    b >>= 1;
  }
  return ans;
}
int a[110];
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0, res = 0;
  for (int i = 1; i <= n / 2; i++)
    scanf("%d", &a[i]), ans += abs(a[i] - i * 2), res += abs(a[i] - 2 * i + 1);
  ans = min(ans, res);
  printf("%d\n", ans);
  return 0;
}
