#include <bits/stdc++.h>
using namespace std;
int arr[201];
int dp[201][4001];
int n;
int solve(int index, int T) {
  if (T > 2 * n) {
    return 1e7;
  }
  if (index == n) {
    return 0;
  }
  if (dp[index][T] != -1) return dp[index][T];
  int ans = 1e7;
  ans = min(ans, solve(index + 1, T + 1) + abs(arr[index] - T));
  ans = min(ans, solve(index, T + 1));
  return dp[index][T] = ans;
}
int main() {
  int t;
  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;
  }
}
