#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
set<int> vectorToSet(vector<int> v) {
set<int> s;
for (auto i : v) s.insert(i);
return s;
}
int t; // testit
vector<int> pakka1;
vector<int> pakka2;
int main() {
cin >> t;
for (int i = 0; i < t; i++) {
pakka1.clear();
pakka2.clear();
s1.clear();
int n; // korttien määrä
cin >> n;
pakka1.resize(n / 2);
for (int i = 0; i < n / 2; i++) cin >> pakka1[i];
sort(pakka1.begin(), pakka1.end());
for (int i = 1, ii = 0; i <= n; i++) {
if (i == pakka1[ii]) {
ii++;
continue;
}
pakka2.push_back(i);
}
/*
cout << "Pakka 1\n";
for (auto i : pakka1) {
cout << i << " ";
}
cout << "\n\n";
cout << "Pakka 2\n";
for (auto i : pakka2) {
cout << i << " ";
}
cout << "\n\n";
*/
int points = 0;
for (int i = n / 2 - 1; i >= 0; i--) {
if (pakka1[i] > pakka2[i]) {
points++;
pakka1.pop_back();
} else {
pakka1.erase(pakka1.begin());
}
}
cout << points << "\n";
}
}