#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  long long int arr[n];
  memset(arr, 0, sizeof arr);
  for (long long int i = 0; i < n / 2; i++) {
    long long int val;
    cin >> val;
    arr[--val] = 1;
  }
  long long int moves = 0, moves2 = 0;
  long long int pos = 0;
  for (long long int i = 0; i < n; i++) {
    if (arr[i] == 1) {
      moves += abs(pos - i);
      pos += 2;
    }
  }
  pos = 1;
  for (long long int i = 0; i < n; i++) {
    if (arr[i] == 1) {
      moves2 += abs(pos - i);
      pos += 2;
    }
  }
  cout << min(moves, moves2);
  return 0;
}
