#include <bits/stdc++.h>
using namespace std;
const int MAX = 205;
int t, n;
int arr[MAX], dp[MAX][MAX * 2];
int main() {
  cin >> t;
  while (t--) {
    memset(arr, 0, sizeof(arr));
    memset(dp, 0x3f, sizeof(dp));
    cin >> n;
    for (int i = 0; i < n; i++) cin >> arr[i];
    sort(arr, arr + n);
    for (int t = 1; t <= n * 2; t++) dp[0][t] = abs(arr[0] - t);
    for (int i = 1; i < n; i++) {
      for (int t = i + 1; t <= n * 2; t++) {
        for (int j = t - 1; j >= i; j--) dp[i][t] = min(dp[i][t], dp[i - 1][j]);
        dp[i][t] += abs(arr[i] - t);
      }
    }
    int res = 0x3f3f3f3f;
    for (int t = n; t <= n * 2; t++) {
      res = min(res, dp[n - 1][t]);
    }
    cout << res << endl;
  }
  return 0;
}
