#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const long long int N = 205;
long long int ar[N];
long long int n;
long long int dp[N][N * 2];
long long int go(long long int i, long long int t) {
  if (i >= n) return 0;
  if (t > n * 2) return (1e18);
  if (dp[i][t] != -1) return dp[i][t];
  return dp[i][t] = min(go(i, t + 1), go(i + 1, t + 1) + abs(ar[i] - t));
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    memset(dp, -1, sizeof(dp));
    cin >> n;
    for (long long int i = 0; i < n; i++) cin >> ar[i];
    sort(ar, ar + n);
    cout << go(0, 1) << "\n";
  }
}
