#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> g;
vector<int> parent;
vector<int> dp, depth, vrtcnt;
int max_depth = 0, cur_depth = -1;
void dfs(int x, int p) {
  if (g[x].size() == 0) {
    depth[x] = 0;
    dp[x] = 0;
    if (p != -1) depth[p] = 1;
  }
}
int main() {
  int n;
  cin >> n;
  dp = vector<int>(n / 2, 0);
  int sum = 0;
  for (int i = 0; i < n / 2; i++) {
    cin >> dp[i];
    sum += abs((i + 1) * 2 - 1 - dp[i]);
  }
  int sum2 = 0;
  for (int i = 0; i < n / 2; i++) sum2 += abs((i + 1) * 2 - dp[i]);
  cout << min(sum, sum2);
  return 0;
}
