#include <bits/stdc++.h>
using namespace ::std;
const long long maxn = 2e5 + 500;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 500;
const long long maxX = 1e7 + 50;
bool a[maxn];
long long find_min(long long n) {
  long long ans = 0;
  long long p = 1;
  for (long long i = 1; i <= n; i += 2) {
    while (a[p] == 0) {
      p++;
    }
    ans += abs(p - i);
    p++;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n / 2; i++) {
    long long v;
    cin >> v;
    a[v] = 1;
  }
  long long ans = find_min(n);
  reverse(a + 1, a + n + 1);
  ans = min(ans, find_min(n));
  cout << ans;
}
