#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
map<long long, long long> mp;
set<long long> s;
long long mn = INT_MAX, mx = INT_MIN;
long long i, j, tmp, sum, cn, ans, res;
int main() {
  long long n, x, odd = 1, even = 2, ans1 = 0, ans2 = 0;
  cin >> n;
  for (i = 1; i <= n / 2; i++) {
    cin >> x;
    ans1 += abs(x - odd);
    ans2 += abs(x - even);
    odd += 2;
    even += 2;
  }
  cout << min(ans1, ans2);
  return 0;
}
