#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int N=2e5+10;
void solve(){
	int n;
	vector<int> b,nb;
    cin>>n;
	for(int i=0,t;i<n;++i){
		cin>>t;
		for(int j=b.empty()?1:b.back()+1;j<t;++j){
			nb.push_back(j);
		}
		b.push_back(t);
	}
	for(int i=b.back()+1;i<=2*n;++i)nb.push_back(i);

	int l,r;
	for(int i=0,j=0;i<=n;++i){
		if(i==n){ r=i; break; }
		while(j<n&&nb[j]<b[i])++j;
		if(j==n){//if not found
			r=i;
			break;
		}
		++j;
	}
	for(int i=n-1,j=n-1;i>=-1;--i){
		if(i==-1){ l=i+1;break;}
		while(j>=0&&nb[j]>b[i])--j;
		if(j==-1){//if not found
			l=i+1;
			break;
		}
		--j;
	}
	cout<<r-l+1<<endl;
}
int main(){
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}
