#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
int n;
vector<int> v;
int dp[201][401];
int solve(int ind, int t) {
  if (ind >= n) return 0;
  if (t > 2 * n) return 1e9;
  if (dp[ind][t] != -1) return dp[ind][t];
  int ans = 1e9;
  ans = min(ans, solve(ind, t + 1));
  ans = min(ans, abs(t - v[ind]) + solve(ind + 1, t + 1));
  return dp[ind][t] = ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  cin >> t;
  while (t--) {
    for (int i = 0; i <= 200; i++) {
      for (int j = 0; j <= 400; j++) dp[i][j] = -1;
    }
    cin >> n;
    v.resize(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
    }
    sort(v.begin(), v.end());
    cout << solve(0, 1) << endl;
    v.clear();
  }
  return 0;
}
