#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, 1, -1, -1, 1, -1, 0};
int dy[] = {0, 1, -1, -1, 1, 1, 0, -1};
void run() {}
int fixMod(int a, int b) { return ((a % b) + b) % b; }
long long gcd(long long a, long long b) {
  return (b == 0 ? abs(a) : gcd(b, a % b));
}
void fast() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  run();
  int n;
  cin >> n;
  n /= 2;
  vector<int> v(n);
  map<int, bool> mp;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    mp[v[i]] = 1;
  }
  sort((v).begin(), (v).end());
  int od = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] % 2) continue;
    int cost = 0;
    bool flag = 0;
    for (int j = v[i] + 1; j < 100; j++)
      if (!mp[j] && j % 2) {
        cost = j - v[i];
        mp[j] = 1;
        flag = 1;
        break;
      }
    for (int j = v[i] - 1; j > 0; j--)
      if (!mp[j] && j % 2) {
        if (flag)
          cost = min(cost, v[i] - j);
        else
          cost = v[i] - j;
        mp[j] = 1;
        break;
      }
    od += cost;
  }
  int ev = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] % 2 == 0) continue;
    int cost = 0;
    bool flag = 0;
    for (int j = v[i] + 1; j <= 100; j++)
      if (!mp[j] && j % 2 == 0) {
        cost = j - v[i];
        mp[j] = 1;
        flag = 1;
        break;
      }
    for (int j = v[i] - 1; j > 0; j--)
      if (!mp[j] && j % 2 == 0) {
        if (flag)
          cost = min(cost, v[i] - j);
        else
          cost = v[i] - j;
        mp[j] = 1;
        break;
      }
    ev += cost;
  }
  cout << min(ev, od) << "\n";
  return 0;
}
