#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, half;
vector<int> v;
void f() {
cin >> n;
half = n / 2;
v.clear();
v.resize(half);
for (int i = half-1; i > -1; i--) cin >> v[i];
sort(v.rbegin(), v.rend());
int points = 0;
int cardsLeft = half;
int i = 0;
while (true) {
if (n == v[i]) {
cardsLeft--;
points++;
i++;
n--;
} else {
cardsLeft -= abs(n - v[i]);
n -= abs(n - v[i]);
}
if (cardsLeft <= 0) break;
}
cout << points << "\n";
}
int t;
int main() {
cin >> t;
for (int i = 0; i < t; i++) f();
}