#include<bits/stdc++.h>
#define int long long
#define ld long double
#define endl '\n'
const int mod=1e9+7;
const int inf=1e18+10;
#define F first
#define S second
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(),x.end()
#define si(a) a.size()
#define pii pair<int,int>
using namespace std;
int modpow(int a,int b){int res=1;while(b){if(b%2){res*=a;}a*=a;res%=mod;a%=mod;b/=2;}return res;}
#if !defined(ONLINE_JUDGE)
#include "debugging.h"
#endif

const int N=2e5+5;
int n, b[N], residue[N];

int chk(int x) {
	//chk issue on right side
	for(int i=x;i<n;i++) {
		if(b[i]<residue[i-x])
			return 1;
	}
	// chk issue on left side
	for(int i=0;i<x;i++) {
		if(b[i]>residue[i+n-x])
			return -1;
	}
	return 0;
}

int32_t main() {
   std::ios::sync_with_stdio(false);cin.tie(NULL);
   int t;
   cin>>t;
   while(t--) {
   	cin>>n;
   	multiset<int>st;
   	for(int i=1;i<=2*n;i++) {
   		st.insert(i);
   	}
   	for(int i=0;i<n;i++) {
   		cin>>b[i];
   		st.erase(b[i]);
   	}
   	auto it=st.begin();
   	for(int i=0;i<n;i++) {
   		residue[i] = *it;
   		it++;
   	}

   	sort(b,b+n);
   	
   	int xmin=0,xmax=0;
   	// calculating x min
   	int lo=0,hi=n;
   	while(lo<=hi) {
   		int mid=(lo+hi)>>1;
   		int issue_side = chk(mid);
   		if(issue_side==1) {
   			lo=mid+1;
   		} else {
   			hi=mid-1;
   			xmin=mid;
   		}
   	}

   	lo=0,hi=n;
   	while(lo<=hi) {
   		int mid=(lo+hi)>>1;
   		int issue_side = chk(mid);
   		if(issue_side==-1) {
   			hi=mid-1;
   		} else {
   			lo=mid+1;
   			xmax=mid;
   		}
   	}
   	// dbgm(xmin,xmax);
   	cout<<xmax-xmin+1<<endl;
   }
   return 0;
}
