#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
string blank = "";
const int N = 205;
int n;
int arr[N];
int dp[N][405];
int recur(int idx, int t) {
  if (idx >= n) return 0;
  if (t >= 405) return 1e9;
  if (~dp[idx][t]) return dp[idx][t];
  return dp[idx][t] =
             min(recur(idx + 1, t + 1) + abs(arr[idx] - t), recur(idx, t + 1));
}
void solve() {
  cin >> n;
  for (long long i = (0); i < (n); i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  cout << recur(0, 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    memset(dp, -1, sizeof dp);
    solve();
    if (t) cout << '\n';
  }
}
