#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e10 + 6;
const long long MOD = 1e9 + 7;
const long long mod = 998244353;
const int MX = 1e6 + 5;
const int LG = 25;
template <typename t>
void fff(const char* x, t&& val1) {
  cout << x << " : " << val1 << "\n";
}
template <typename t1, typename... t2>
void fff(const char* x, t1&& val1, t2&&... val2) {
  const char* xd = strchr(x + 1, ',');
  cout.write(x, xd - x) << " : " << val1 << " | ";
  fff(xd + 1, val2...);
}
long long a[MX];
long long b[MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (int i = 0; i < n / 2; i++) {
    cin >> a[i];
  }
  long long sum = 0, sum1 = 0;
  long long j = 1;
  for (int i = 0; i < n / 2; i++) {
    sum += abs(a[i] - j);
    j += 2;
  }
  j = 2;
  for (int i = 0; i < n / 2; i++) {
    sum1 += abs(a[i] - j);
    j += 2;
  }
  cout << min(sum, sum1) << endl;
}
