#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define rep(a,b,c) for(int a=(int)b;a<(int)c;a++)
#define repe(a,b,c) for(int a=(int)b;a<=(int)c;a++)
#define repk(a,b,c,k) for(int a=(int)b;a<(int)c;a+=(int)k)
#define fastio std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007
#define modu 998244353
#define int long long int
#define pii pair<int,int>
#define piii pair<int,pair<int,int>>
#define ful(a) a.begin(),a.end()
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define clr(x)  memset((x),0,sizeof(x))
#define neg1(x) memset((x),-1,sizeof(x))
#define pos1(x) memset((x),1,sizeof(x)) 
#define ordered_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
//using namespace __gnu_pbds;
#define MAXN 300009
#define MAXW 2009
int em(int x,int Mod,int n)
{
    if(n==0)
    return 1ll;
    else if(n%2==0)
    return em((x%Mod*x%Mod)%Mod,Mod,n/2)%Mod;
    else
    return (x%Mod*em((x%Mod*x%Mod)%Mod,Mod,(n-1)/2))%Mod;
}
int32_t main() 
{  
    fastio 
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin); 
        freopen("output.txt","w",stdout);
    #endif
    int t,n,i,j,k,l;
    cin>>t;
    while(t--){
        cin>>n;
        
        vector<int>v(n),nv;
        map<int,int>ma;
        
        rep(i,0,n){
            cin>>v[i];
            ma[v[i]]=1;
        }
        sort(ful(v));

        rep(i,1,2*n+1){
            if(!ma[i])
                nv.push_back(i);
        }
        
        int lo=0,hi=n,left=n+1,right;

        while(lo<=hi){
            int mid = (lo+hi)/2;
            int flag = 0;
            rep(i,mid,n){
                if(v[i]<nv[i-mid]){
                    flag=1;
                    break;
                }
            }

            if(flag==1){
                lo=mid+1;
            }
            else{
                left=mid;
                hi=mid-1;
            }
        }

        lo=left,hi=n,right=left-1;

        while(lo<=hi){
            int mid = (lo+hi)/2;
            int flag = 0;
            rep(i,0,mid){
                if(v[i]>nv[n-mid+i]){
                    flag=1;
                    break;
                }
            }

            if(flag==0){
                right=mid;
                lo=mid+1;
            }
            else{
                hi=mid-1;
            }
        }

        cout<<right-left+1<<"\n";
    }    

}
