#include <bits/stdc++.h>
const long double eps = 0.00000001;
const long long MOD = 1e9 + 7;
using namespace std;
int a[200];
int main() {
  fflush(stdin);
  cout << fixed, cout.precision(18);
  ios_base::sync_with_stdio(false);
  int i, j, n, m;
  cin >> n;
  m = n / 2;
  int b[m];
  set<int> odd, even;
  for (i = 1; i <= n; ++i) {
    if (i % 2 == 0)
      odd.insert(i);
    else
      even.insert(i);
  }
  for (i = 0; i < m; ++i) {
    cin >> b[i];
    if (b[i] % 2 == 0)
      odd.erase(b[i]);
    else
      even.erase(b[i]);
  }
  sort(b, b + m);
  int ans1 = 0, ans2 = 0;
  for (i = 0; i < m; ++i) {
    if (b[i] % 2 == 0) {
      auto it = even.upper_bound(b[i]);
      if (it == even.end()) {
        --it;
        ans1 += (abs(b[i] - *it));
        even.erase(it);
      } else if (it == even.begin()) {
        ans1 += abs((b[i] - *it));
        even.erase(it);
      } else {
        auto it2 = --it;
        if (abs(b[i] - *it) > abs(b[i] - *it2)) {
          ans1 += (abs(b[i] - *it2));
          even.erase(it2);
        } else if (abs(b[i] - *it) < abs(b[i] - *it2)) {
          ans1 += (abs(b[i] - *it));
          even.erase(it);
        } else {
          ans1 += (abs(b[i] - *it));
          even.erase(it);
        }
      }
    }
  }
  for (i = 0; i < m; ++i) {
    if (b[i] % 2 == 1) {
      auto it = odd.upper_bound(b[i]);
      if (it == odd.end()) {
        --it;
        ans2 += (abs(b[i] - *it));
        odd.erase(it);
      } else if (it == odd.begin()) {
        ans2 += abs((b[i] - *it));
        odd.erase(it);
      } else {
        auto it2 = --it;
        if (abs(b[i] - *it) > abs(b[i] - *it2)) {
          ans2 += (abs(b[i] - *it2));
          odd.erase(it2);
        } else if (abs(b[i] - *it) < abs(b[i] - *it2)) {
          ans2 += (abs(b[i] - *it));
          odd.erase(it);
        } else {
          ans2 += (abs(b[i] - *it));
          odd.erase(it);
        }
      }
    }
  }
  cout << min(ans1, ans2);
}
