#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> a(205);
int dp[1005][205];
int rec(int t, int idx) {
  if (idx == n) return 0;
  if (t == 4 * n + 5) return 1000000007;
  int &res = dp[t][idx];
  if (res != -1) return res;
  int a1 = rec(t + 1, idx);
  int a2 = rec(t + 1, idx + 1) + abs(t - a[idx]);
  res = min(a1, a2);
  return res;
}
void solve() {
  cin >> n;
  a.resize(n);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort((a).begin(), (a).end());
  for (long long int i = 0; i < 4 * n + 5; i++) {
    for (long long int j = 0; j < n + 5; j++) {
      dp[i][j] = -1;
    }
  }
  cout << rec(1, 0) << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  cin >> TESTS;
  while (TESTS--) {
    solve();
  }
  return 0;
}
