#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int a[n / 2], x = 1, y = 2, sum1 = 0, sum2 = 0;
    for (int i = 0; i < n / 2; i++) {
      cin >> a[i];
      sum1 += abs(x - a[i]);
      sum2 += abs(y - a[i]);
      y += 2;
      x += 2;
    }
    cout << min(sum1, sum2) << endl;
  }
}
