// Created by Pratik
// NIT PATNA

#include <bits/stdc++.h>

// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
// using namespace __gnu_pbds;

using namespace std;
#define M                    1000000007
#define pi                   3.14159265358979323846
#define ll                   long long
#define lld                  long double

// Pair
#define pii                  pair<int, int>
#define pll                  pair<ll, ll>

// Vector
#define vl                   vector<ll >
#define vi                   vector<int>
#define vpi                  vector<pii>
#define vpl                  vector<pll>
#define pb                   push_back
#define mp                   make_pair


// Search
#define lb                   lower_bound
#define ub                   upper_bound
#define mina                 *min_element
#define mama                 *max_element
#define bsrch                binary_search

////////
#define F                    first
#define S                    second
#define cel(x,a)             ((x + a - 1) / a)
#define all(v)               v.begin(), v.end()
#define allrev(v)            v.rbegin(), v.rend()
#define lcm(m, n)            ((m / __gcd(m, n))*n)
#define deb(...)             cerr << "(" << #__VA_ARGS__ << "):", dbg(__VA_ARGS__)
#define ms(arr, v)           memset(arr, v, sizeof(arr))
#define ps(x,y)              fixed << setprecision(y) << x
#define _X_                  ios_base::sync_with_stdio(false); cin.tie(NULL)

//pbds
#define ordered                 tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

// Input / Output
#define scn(str)             scanf("%s", str)
#define pri(str)             printf("%s\n", str)


const int N = 2.5e6 + 4;

inline void  dbg()           { cerr << endl; }


template <typename T, typename... V>
inline void  dbg(T t, V... v) {cerr << ' ' << t; dbg(v...);}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void solve()
{
    int n;
    cin >> n;
    vi arr(n+2),brr;
    arr[0] = 0;
    for(int i = 0; i<n; i++)cin >> arr[i+1];
    arr[n+1] = 2*n+1;
	int cur = 1;
	for(int i = 1; i<=2*n; i++)
	{
		if(cur<n+2 && arr[cur]==i)
		{
			cur++;
			continue;
		}
		brr.pb(i);
	}
	int l = 0,r = n+1;
	while(l+1<r)
	{
		int mid = (l+r)/2;
		bool ok1 = 1;
		cur = 0;
		for(int i = mid; i<n+1; i++,cur++)
		{
			if(arr[i]<brr[cur])ok1 = 0;
		}
		if(ok1)r = mid;
		else l = mid;
		//deb(ok1,ok2,l,r);
	}
	//deb(l,r);
	int mn = r;
	l = 0,r = n+1;
	while(l+1<r)
	{
		
		int mid = (l+r)/2;
		bool ok2 = 1;
		cur = n-mid;
		for(int i = 1; i<=mid; i++,cur++)
		{
			if(arr[i]>brr[cur])ok2 = 0;
		}
		if(ok2)l = mid;
		else r = mid;
		
	}
	int mx = r;
	//deb(mx,mn);
	cout << mx-mn+1 << "\n";
			
}


int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
    // clock_t time_req = clock();

    int t = 1;
     cin>> t;
    while (t--) {
       solve();



   }


    // time_req = clock() - time_req;
    // cout << (float)time_req / CLOCKS_PER_SEC;
   return 0;
}
