#include <bits/stdc++.h>
using namespace std;
int n;
int arr[201], dp[201][2 * 201];
int solve(int idx, int t) {
  if (idx == n) return 0;
  if (t == 2 * n + 1) return 1e7;
  if (dp[idx][t] != -1) return dp[idx][t];
  int ans = INT_MAX;
  ans = min(ans, solve(idx, t + 1));
  ans = min(ans, abs(t - arr[idx]) + solve(idx + 1, t + 1));
  return dp[idx][t] = ans;
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> arr[i];
    for (int i = 0; i < n; i++)
      for (int j = 0; j <= 2 * n; j++) dp[i][j] = -1;
    sort(arr, arr + n);
    cout << solve(0, 1) << endl;
  }
  return 0;
}
