#include <bits/stdc++.h>   using namespace std;   const int mod = 998244353;   const int N = 2e5 + 6;   int cnt[666], dp[777][777];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int _, n;     cin >> _;     while (_--) {       cin >> n;       for (int i = 0; i <= n - 1; i++) cin >> cnt[i];       for (int i = 0; i <= n; i++)         for (int j = 0; j <= n * 2; j++) dp[i][j] = 1e9;       sort(cnt, cnt + n);       int ans = 1e9;       dp[0][0] = 0;       for (int i = 1; i <= n; i++) {         for (int j = 1; j <= n * 2; j++) {           for (int k = 0; k <= j - 1; k++) {             dp[i][j] = min(dp[i - 1][k] + abs(cnt[i - 1] - j), dp[i][j]);             if (n - i == 0) ans = min(ans, dp[i][j]);           }         }       }       cout << ans << endl;     }     return 0;   }   