#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int n, half;
vector<int> a;
vector<int> answers;
void f() {
cin >> n;
half = n/2;
a.clear();
a.resize(half);
for (int i = 0; i < half; i++) cin >> a[i];
sort(a.begin(), a.end());
int m = 0;
int ia = 0;
int points = 0;
for (int i = 1; i <= n; i++) {
if (a[ia] != i) {
m++;
} else {
ia++;
if (m > 0) {
m--;
points++;
}
}
}
answers.push_back(points);
}
int t;
int main() {
cin >> t;
for (int i = 0; i < t; i++) f();
for (auto i : answers) {
cout << i << "\n";
}
}