#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int INF = 3e18;
long long int power(long long int base, long long int exp) {
  long long int res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base);
    base = (base * base);
    exp /= 2;
  }
  return res;
}
long long int bitc(long long int n, long long int x) { return ((n >> x) & 1); }
long long int __gcd(long long int a, long long int b) {
  return b == 0 ? a : __gcd(b, a % b);
}
long long int fsub(long long int a, long long int b, long long int p = MOD) {
  return ((a % p) - (b % p) + p) % p;
}
long long int fmult(long long int a, long long int b, long long int p = MOD) {
  return ((((a % p) * (b % p)) % p) + p) % p;
}
long long int fadd(long long int a, long long int b, long long int p = MOD) {
  return ((a % p + b % p) % p + p) % p;
}
long long int fpow(long long int n, long long int k, long long int p = MOD) {
  long long int r = 1;
  while (k > 0) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
    k = k >> 1;
  }
  return r;
}
long long int inv(long long int a, long long int p = MOD) {
  return fpow(a, p - 2, p);
}
long long int fdiv(long long int a, long long int b, long long int p = MOD) {
  long long int yinv = inv(b);
  long long int ans = (a * yinv) % p;
  return ((ans) % p + p) % p;
}
long long int ceil(long long int a, long long int b) {
  return ceil((long double)a / b);
}
template <typename T>
istream &operator>>(istream &in, vector<T> &a) {
  for (auto &item : a) {
    in >> item;
  }
  return in;
}
template <typename T, typename U>
ostream &operator<<(ostream &out, pair<T, U> &a) {
  cout << a.first << " " << a.second;
  return out;
}
template <typename T, typename U>
istream &operator>>(istream &out, pair<T, U> &a) {
  cin >> a.first >> a.second;
  return out;
}
template <typename T, typename U>
ostream &operator<<(ostream &out, map<T, U> &a) {
  for (auto &item : a) {
    out << item << "\n";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &a) {
  for (auto &item : a) {
    out << item << " ";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<vector<T>> &a) {
  for (auto &item : a) {
    out << item << "\n";
  }
  return out;
}
template <int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(int n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {}
};
std::vector<bool> is_prime;
std::vector<long long int> primes;
void sieve(long long int n) {
  is_prime.resize(n + 2, true);
  primes.clear();
  long long int p;
  for (p = 2; p * p <= n; p++) {
    if (is_prime[p]) {
      long long int i;
      for (i = p * p; i <= n; i += p) {
        is_prime[i] = false;
      }
    }
  }
  is_prime[0] = is_prime[1] = false;
  long long int i;
  for (i = 2; i <= n; i++) {
    if (is_prime[i]) {
      primes.emplace_back(i);
    }
  }
}
map<long long int, long long int> prime_factors(long long int n) {
  map<long long int, long long int> s;
  long long int i;
  long long int tc = 0;
  while (n % 2 == 0) {
    tc++;
    n /= 2;
  }
  if (tc > 0) {
    s[2] = tc;
  }
  for (i = 3; i <= sqrt(n); i += 2) {
    tc = 0;
    while (n % i == 0) {
      tc++;
      n /= i;
    }
    if (tc > 0) {
      s[i] = tc;
    }
  }
  if (n > 2) {
    s[n] += 1;
  }
  return s;
}
std::vector<long long int> fact_vec;
void fact_fun(long long int n) {
  fact_vec.resize(n + 10);
  long long int i;
  fact_vec[0] = 1;
  for (i = 1; i <= n + 2; i++) {
    fact_vec[i] = (fact_vec[i - 1] * i) % MOD;
  }
}
std::vector<long long int> p2;
void power_2(long long int n, long long int m = MOD) {
  long long int i;
  p2.emplace_back(1);
  for (i = 0; i < n; i++) {
    p2.emplace_back(fmult(p2.back(), 2));
  }
}
long long int ncr(long long int n, long long int r) {
  if (r > n) return 0;
  return fdiv(fact_vec[n], fmult(fact_vec[r], fact_vec[n - r]));
}
std::vector<long long int> spf;
void sieve2(long long int MAXN) {
  MAXN += 10;
  spf.resize(MAXN, 0);
  spf[1] = 1;
  for (long long int i = 2; i < MAXN; i++) spf[i] = i;
  for (long long int i = 4; i < MAXN; i += 2) spf[i] = 2;
  for (long long int i = 3; i * i < MAXN; i++) {
    if (spf[i] == i) {
      for (long long int j = i * i; j < MAXN; j += i) {
        if (spf[j] == j) spf[j] = i;
      }
    }
  }
}
const int mi[4] = {-1, 0, 1, 0}, mj[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1},
          d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};
map<long long int, long long int> getFactorization(long long int x) {
  map<long long int, long long int> ret;
  while (x != 1) {
    ret[spf[x]]++;
    x = x / spf[x];
  }
  return ret;
}
class Sol {
 public:
  Sol() { long long int i, j; }
};
long long int n;
std::vector<long long int> v;
const long long int N = 405;
Vec<2, long long int> dp;
long long int solve(long long int i, long long int j) {
  if (i == n) {
    return 0;
  }
  if (j == N) {
    return INF;
  }
  auto &res = dp[i][j];
  if (~res) {
    return res;
  }
  long long int lans = 0, rans = 0;
  lans = abs(v[i] - j) + solve(i + 1, j + 1);
  rans = solve(i, j + 1);
  return res = min(lans, rans);
}
int main() {
  long long int i, j;
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int ti;
  ti = 1;
  cin >> ti;
  while (ti--) {
    cin >> n;
    dp.clear();
    dp.resize(n, {N, -1});
    v.resize(n);
    cin >> v;
    sort((v).begin(), (v).end());
    long long int ans = solve(0, 1);
    cout << ans << "\n";
  }
  return 0;
}

### Prompt

Generate a CPP solution to the following problem:

Chef Monocarp has just put n dishes into an oven. He knows that the i-th dish has its optimal cooking time equal to t_i minutes.

At any positive integer minute T Monocarp can put no more than one dish out of the oven. If the i-th dish is put out at some minute T, then its unpleasant value is |T - t_i| — the absolute difference between T and t_i. Once the dish is out of the oven, it can't go back in.

Monocarp should put all the dishes out of the oven. What is the minimum total unpleasant value Monocarp can obtain?

Input

The first line contains a single integer q (1 ≤ q ≤ 200) — the number of testcases.

Then q testcases follow.

The first line of the testcase contains a single integer n (1 ≤ n ≤ 200) — the number of dishes in the oven.

The second line of the testcase contains n integers t_1, t_2, ..., t_n (1 ≤ t_i ≤ n) — the optimal cooking time for each dish.

The sum of n over all q testcases doesn't exceed 200.

Output

Print a single integer for each testcase — the minimum total unpleasant value Monocarp can obtain when he puts out all the dishes out of the oven. Remember that Monocarp can only put the dishes out at positive integer minutes and no more than one dish at any minute.

Example

Input


6
6
4 2 4 4 5 2
7
7 7 7 7 7 7 7
1
1
5
5 1 2 4 3
4
1 4 4 4
21
21 8 1 4 1 5 21 1 8 21 11 21 11 3 12 8 19 15 9 11 13


Output


4
12
0
0
2
21

Note

In the first example Monocarp can put out the dishes at minutes 3, 1, 5, 4, 6, 2. That way the total unpleasant value will be |4 - 3| + |2 - 1| + |4 - 5| + |4 - 4| + |6 - 5| + |2 - 2| = 4.

In the second example Monocarp can put out the dishes at minutes 4, 5, 6, 7, 8, 9, 10.

In the third example Monocarp can put out the dish at minute 1.

In the fourth example Monocarp can put out the dishes at minutes 5, 1, 2, 4, 3.

In the fifth example Monocarp can put out the dishes at minutes 1, 3, 4, 5.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int INF = 3e18;
long long int power(long long int base, long long int exp) {
  long long int res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base);
    base = (base * base);
    exp /= 2;
  }
  return res;
}
long long int bitc(long long int n, long long int x) { return ((n >> x) & 1); }
long long int __gcd(long long int a, long long int b) {
  return b == 0 ? a : __gcd(b, a % b);
}
long long int fsub(long long int a, long long int b, long long int p = MOD) {
  return ((a % p) - (b % p) + p) % p;
}
long long int fmult(long long int a, long long int b, long long int p = MOD) {
  return ((((a % p) * (b % p)) % p) + p) % p;
}
long long int fadd(long long int a, long long int b, long long int p = MOD) {
  return ((a % p + b % p) % p + p) % p;
}
long long int fpow(long long int n, long long int k, long long int p = MOD) {
  long long int r = 1;
  while (k > 0) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
    k = k >> 1;
  }
  return r;
}
long long int inv(long long int a, long long int p = MOD) {
  return fpow(a, p - 2, p);
}
long long int fdiv(long long int a, long long int b, long long int p = MOD) {
  long long int yinv = inv(b);
  long long int ans = (a * yinv) % p;
  return ((ans) % p + p) % p;
}
long long int ceil(long long int a, long long int b) {
  return ceil((long double)a / b);
}
template <typename T>
istream &operator>>(istream &in, vector<T> &a) {
  for (auto &item : a) {
    in >> item;
  }
  return in;
}
template <typename T, typename U>
ostream &operator<<(ostream &out, pair<T, U> &a) {
  cout << a.first << " " << a.second;
  return out;
}
template <typename T, typename U>
istream &operator>>(istream &out, pair<T, U> &a) {
  cin >> a.first >> a.second;
  return out;
}
template <typename T, typename U>
ostream &operator<<(ostream &out, map<T, U> &a) {
  for (auto &item : a) {
    out << item << "\n";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<T> &a) {
  for (auto &item : a) {
    out << item << " ";
  }
  return out;
}
template <typename T>
ostream &operator<<(ostream &out, vector<vector<T>> &a) {
  for (auto &item : a) {
    out << item << "\n";
  }
  return out;
}
template <int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template <typename... Args>
  Vec(int n = 0, Args... args)
      : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {}
};
template <typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, T val = T()) : vector<T>(n, val) {}
};
std::vector<bool> is_prime;
std::vector<long long int> primes;
void sieve(long long int n) {
  is_prime.resize(n + 2, true);
  primes.clear();
  long long int p;
  for (p = 2; p * p <= n; p++) {
    if (is_prime[p]) {
      long long int i;
      for (i = p * p; i <= n; i += p) {
        is_prime[i] = false;
      }
    }
  }
  is_prime[0] = is_prime[1] = false;
  long long int i;
  for (i = 2; i <= n; i++) {
    if (is_prime[i]) {
      primes.emplace_back(i);
    }
  }
}
map<long long int, long long int> prime_factors(long long int n) {
  map<long long int, long long int> s;
  long long int i;
  long long int tc = 0;
  while (n % 2 == 0) {
    tc++;
    n /= 2;
  }
  if (tc > 0) {
    s[2] = tc;
  }
  for (i = 3; i <= sqrt(n); i += 2) {
    tc = 0;
    while (n % i == 0) {
      tc++;
      n /= i;
    }
    if (tc > 0) {
      s[i] = tc;
    }
  }
  if (n > 2) {
    s[n] += 1;
  }
  return s;
}
std::vector<long long int> fact_vec;
void fact_fun(long long int n) {
  fact_vec.resize(n + 10);
  long long int i;
  fact_vec[0] = 1;
  for (i = 1; i <= n + 2; i++) {
    fact_vec[i] = (fact_vec[i - 1] * i) % MOD;
  }
}
std::vector<long long int> p2;
void power_2(long long int n, long long int m = MOD) {
  long long int i;
  p2.emplace_back(1);
  for (i = 0; i < n; i++) {
    p2.emplace_back(fmult(p2.back(), 2));
  }
}
long long int ncr(long long int n, long long int r) {
  if (r > n) return 0;
  return fdiv(fact_vec[n], fmult(fact_vec[r], fact_vec[n - r]));
}
std::vector<long long int> spf;
void sieve2(long long int MAXN) {
  MAXN += 10;
  spf.resize(MAXN, 0);
  spf[1] = 1;
  for (long long int i = 2; i < MAXN; i++) spf[i] = i;
  for (long long int i = 4; i < MAXN; i += 2) spf[i] = 2;
  for (long long int i = 3; i * i < MAXN; i++) {
    if (spf[i] == i) {
      for (long long int j = i * i; j < MAXN; j += i) {
        if (spf[j] == j) spf[j] = i;
      }
    }
  }
}
const int mi[4] = {-1, 0, 1, 0}, mj[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1},
          d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};
map<long long int, long long int> getFactorization(long long int x) {
  map<long long int, long long int> ret;
  while (x != 1) {
    ret[spf[x]]++;
    x = x / spf[x];
  }
  return ret;
}
class Sol {
 public:
  Sol() { long long int i, j; }
};
long long int n;
std::vector<long long int> v;
const long long int N = 405;
Vec<2, long long int> dp;
long long int solve(long long int i, long long int j) {
  if (i == n) {
    return 0;
  }
  if (j == N) {
    return INF;
  }
  auto &res = dp[i][j];
  if (~res) {
    return res;
  }
  long long int lans = 0, rans = 0;
  lans = abs(v[i] - j) + solve(i + 1, j + 1);
  rans = solve(i, j + 1);
  return res = min(lans, rans);
}
int main() {
  long long int i, j;
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int ti;
  ti = 1;
  cin >> ti;
  while (ti--) {
    cin >> n;
    dp.clear();
    dp.resize(n, {N, -1});
    v.resize(n);
    cin >> v;
    sort((v).begin(), (v).end());
    long long int ans = solve(0, 1);
    cout << ans << "\n";
  }
  return 0;
}

```