#include <bits/stdc++.h>
using namespace std;
int main()
{
int t, n;
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> n;
vector<bool> isown(n + 1);
vector<bool> used(n + 1);
int points = 0;
for (int j = 0; j < n / 2; j++)
{
int x;
cin >> x;
isown[x] = true;
}
for (int j = 1; j <= n; j++)
{
if (!isown[j])
{
int minx = 9999999;
for (int r = 1; r <= n; r++)
{
if (!used[r] && isown[r] && r > j)
{
if (minx - j > r - j)
{
minx = r;
}
}
}
if (minx != 9999999)
{
used[minx] = true;
points++;
}
}
}
cout << points << "\n";
}
return 0;
}