#include <bits/stdc++.h>
using namespace std;
long long n, mx, dp[210][420], my_arr[210];
long long fun(long long id, long long crr_time) {
  if (id == n) {
    return 0;
  }
  if (dp[id][crr_time] != -1) {
    return dp[id][crr_time];
  }
  if (n - id == mx - crr_time + 1) {
    long long a = abs(my_arr[id] - crr_time) + fun(id + 1, crr_time + 1);
    return dp[id][crr_time] = a;
  }
  return dp[id][crr_time] =
             min(abs(my_arr[id] - crr_time) + fun(id + 1, crr_time + 1),
                 fun(id, crr_time + 1));
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    mx = n << 1;
    memset(dp, -1, sizeof(dp));
    for (int i = 0; i < n; i++) {
      cin >> my_arr[i];
    }
    sort(my_arr, my_arr + n);
    cout << fun(0, 1) << '\n';
  }
}
