#include <bits/stdc++.h>
using namespace std;
long long n, T[200];
vector<vector<long long>> dp;
long long solve(long long i, long long t) {
  if (i == n) return 0;
  if (t == 2 * n) return INT_MAX;
  if (dp[i][t] != -1) return dp[i][t];
  long long ans = INT_MAX;
  ans = solve(i, t + 1);
  ans = min(ans, solve(i + 1, t + 1) + abs(T[i] - t));
  return dp[i][t] = ans;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long test;
  cin >> test;
  while (test--) {
    cin >> n;
    dp = vector<vector<long long>>(n, vector<long long>(2 * n + 1, -1));
    for (long long i = 0; i < n; i++) cin >> T[i];
    sort(T, T + n);
    cout << solve(0, 1) << "\n";
  }
  return 0;
}
