#include <bits/stdc++.h>
using namespace std;
#define int long long int

int32_t main()
{
    int t = 1;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector <int> B(n), right(n), left(n);
        for( int i = 0; i < n; i++ )
            cin>>B[i];
        
        for( int i = 0; i < n; i++ )
        {
            right[i] = (2*n - B[i]) - (n - 1 - i);
            left[i] = (B[i] - 1) - i;
        }
        
        int occ = 0, ocb = 0;
        for( int i = n - 1; i >= 0; i-- )
            if( right[i] > occ )
                occ++;

        for( int i = 0; i < n; i++ )
            if( left[i] > ocb )
                ocb++;

        vector <int> A = {n - ocb, occ};
        sort( A.begin(), A.end() );
        cout<<A[1] - A[0] + 1<<endl;

    }

    return 0;
};