#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int arr[n + 1];
  int a = n / 2;
  for (int i = 0; i < a; i++) cin >> arr[i];
  long long int c1 = 0;
  long long int c2 = 0;
  long long int j = 1;
  for (int i = 0; i < a; i++) {
    c1 = c1 + abs(j - arr[i]);
    j = j + 2;
  }
  j = 2;
  for (int i = 0; i < a; i++) {
    c2 = c2 + abs(j - arr[i]);
    j = j + 2;
  }
  long long int ans = min(c1, c2);
  cout << ans << endl;
  return 0;
}
