#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
int main()
{
int tests, n;
std::cin >> tests;
std::array<int, 101> own;
std::array<int, 101> opponent;
std::vector<int> input;
std::vector<int> results;
for (int t = 0; t < tests; t++)
{
std::cin >> n;
int x = n / 2;
int nextCard = 1;
int oppIdx = 0;
int ownIdx = 0;
input.clear();
for (int i = 0; i < x; i++)
{
int card;
std::cin >> card;
input.emplace_back(card);
}
std::sort(input.begin(), input.end());
for (int card : input)
{
while (card > nextCard)
{
opponent[oppIdx++] = nextCard++;
}
own[ownIdx++] = nextCard++;
}
while (oppIdx < x)
{
opponent[oppIdx++] = nextCard++;
}
/*
for (int p = 0; p < x; p++)
std::cout << "Own: " << own[p] << std::endl;
for (int p = 0; p < x; p++)
std::cout << "Opp: " << opponent[p] << std::endl;
*/
int playedBig = 0;
int playedSmall = 0;
int won = 0;
for (int i = 0; i < x; i++)
{
int oc = opponent[x - 1 - i];
int big = own[x - 1 - playedBig];
if (big > oc)
{
won++;
playedBig++;
}
else
{
if (own[playedSmall++] > oc)
{
won++;
}
}
}
results.emplace_back(won);
}
for (int w : results)
{
std::cout << w << "\n";
}
return 0;
}