#include <bits/stdc++.h>
using namespace std;
inline long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
inline long long int fast_pow(long long int a, long long int b,
                              long long int mod) {
  long long int res = 1;
  a %= mod;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
inline bool isPrime(long long int a) {
  for (long long int i = 2; i * i <= a; i++)
    if (a % i == 0) return 0;
  return 1;
}
int n, arr[110], min_, temp;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n / 2; i++) cin >> arr[i];
  for (int i = 1, j = 0; i <= n; i += 2, j++) {
    min_ += abs(i - arr[j]);
  }
  for (int i = 2, j = 0; i <= n; i += 2, j++) {
    temp += abs(i - arr[j]);
  }
  cout << min(min_, temp) << '\n';
  return 0;
}
