#include <bits/stdc++.h>   using namespace std;   #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   #pragma GCC optimize( unroll-loops )   #pragma GCC optimize( Ofast )   #pragma GCC optimize( O3 )   #pragma GCC target( avx )   const long long INF = numeric_limits<long long>::max();   const long double PI = 3.1415926535898;   const long long MOD = 1000000007;   const long long LIM = 100005;   long long fpow(long long x, long long y) {     long long temp;     if (y == 0) return 1;     temp = fpow(x, y / 2);     if (y % 2 == 0)       return temp * temp;     else       return x * temp * temp;   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   bool isPrime(long long n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (long long i = 5; i * i <= n; i = i + 6)       if (n % i == 0 || n % (i + 2) == 0) return false;     return true;   }   long long modInverse(long long n, long long p) { return fpow(n, p - 2); }   map<long long, long long> primeFactors(long long n) {     map<long long, long long> mp;     while (n % 2 == 0) {       if (mp.count(2) == 1)         mp[2]++;       else         mp.insert({2, 1});       n = n / 2;     }     for (long long i = 3; i <= sqrt(n); i = i + 2) {       while (n % i == 0) {         if (mp.count(i) == 1)           mp[i]++;         else           mp.insert({i, 1});         n = n / i;       }     }     if (n > 2) {       if (mp.count(n) == 1)         mp[n]++;       else         mp.insert({n, 1});     }     return mp;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long t;     cin >> t;     for (long long tt = 1; tt <= t; ++tt) {       long long n, ans = 0;       cin >> n;       vector<long long> t(n + 1);       for (long long i = 1; i <= n; i++) cin >> t[i];       t[0] = 0;       sort(t.begin(), t.end());       ;       long long dp[n + 1][2 * n + 1];       for (long long i = 0; i <= n; i++)         for (long long j = 0; j <= 2 * n; j++) dp[i][j] = INF;       for (long long i = 0; i <= 2 * n; i++) dp[0][i] = 0;       for (long long i = 1; i <= n; i++) {         for (long long j = i; j <= 2 * n; j++) {           dp[i][j] = min(dp[i][j - 1], dp[i - 1][j - 1] + abs(t[i] - j));         }       }       ans = dp[n][2 * n];       cout << ans <<   n ;     }     return 0;   }   